analitics

Pages

Wednesday, August 29, 2018

PyOpenGL: Fix Attempt to call an undefined function glutInit .

This tutorial is about how to fix this error using Python version 3.6.4 :
OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit,
check for bool(glutInit) before calling
First I start with a common pip3.6 install.
Scripts>pip3.6.exe install PyOpenGL
Collecting PyOpenGL
  Downloading https://files.pythonhosted.org/packages/9c/1d/4544708aaa89f26c97cc
09450bb333a23724a320923e74d73e028b3560f9/PyOpenGL-3.1.0.tar.gz (1.2MB)
    100% |████████████████████████████████| 1.2MB 1.2MB/s
Building wheels for collected packages: PyOpenGL
  Running setup.py bdist_wheel for PyOpenGL ... done
  Stored in directory: C:\Users\catafest\AppData\Local\pip\Cache\wheels\6c\00\7f
\1dd736f380848720ad79a1a1de5272e0d3f79c15a42968fb58
Successfully built PyOpenGL
Installing collected packages: PyOpenGL
Successfully installed PyOpenGL-3.1.0
When I run my python script code I got this error:
c:\Python364\Scripts>cd ..
c:\Python364>python.exe opengl_001.py
Traceback (most recent call last):
  File "opengl_001.py", line 182, in 
    StereoDepth().main()
  File "opengl_001.py", line 173, in main
    glutInit()
  File "c:\Python364\lib\site-packages\OpenGL\GLUT\special.py", line 333, in glu
tInit
    _base_glutInit( ctypes.byref(count), holder )
  File "c:\Python364\lib\site-packages\OpenGL\platform\baseplatform.py", line 40
7, in __call__
    self.__name__, self.__name__,
OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit,
check for bool(glutInit) before calling
I use the whl files from here.
c:\Python364>cd Scripts

c:\Python364\Scripts>pip3.6.exe install PyOpenGL-3.1.2-cp36-cp36m-win_amd64.whl
Processing c:\python364\scripts\pyopengl-3.1.2-cp36-cp36m-win_amd64.whl
Installing collected packages: PyOpenGL
  Found existing installation: PyOpenGL 3.1.0
    Uninstalling PyOpenGL-3.1.0:
      Successfully uninstalled PyOpenGL-3.1.0
Successfully installed PyOpenGL-3.1.2

c:\Python364\Scripts>pip3.6.exe install PyOpenGL_accelerate-3.1.2-cp36-cp36m-win
_amd64.whl
Processing c:\python364\scripts\pyopengl_accelerate-3.1.2-cp36-cp36m-win_amd64.w
hl
Installing collected packages: PyOpenGL-accelerate
Successfully installed PyOpenGL-accelerate-3.1.2
This allow me to run well the python script with PyOpenGL python module.
This is result of shader stereo depth image:

Sunday, July 15, 2018

Python 3.6.4 : Microsoft Azure - bad answer .

The Azure from Microsoft comes with the free account and $200 credit to explore services for 30 days.
I only have 7 days left from this free account.
During this time I tried to use it from scratch.
In this short tutorial, I will talk about this period,
First I used the python version 3.6.4 and the Azure development tools.
These are the links I follow:
I install the azure for python with :
C:\Python364\Scripts>pip install azure
You can use a preview version of this package, which you can access using the --pre flag:
C:\Python364\Scripts>pip install --pre azure
I used the example from azure:
git clone https://github.com/Azure-Samples/storage-blobs-python-quickstart.git
Into azure account, I create a storage account named pythonazure.

You can configure the Access control (IAM) to use with your account.
This storage account needs to use keys, see Access keys area.
They tell us about this feature:
Use access keys to authenticate your applications when making requests to this Azure storage account. Store your access keys securely - for example, using Azure Key Vault - and don't share them. We recommend regenerating your access keys regularly. You are provided two access keys so that you can maintain connections using one key while regenerating the other.
I change the account name with pythonazure and account_key with my account key.
The result is this:

In view of my previous experiences with Google, Firebase and Azure on the ease of assimilation and understanding of the content and the time allocated to making a simple task according to the Azure documentation, then azure get the last place.
In azure services, we can see the errors that occur and which are non-existent on google or firebase.

I was interested in ease and fast access to python cloud services. However, you can read this point of view written by google here.