unable to call glCreate* in pyOpenGL - opengl

I'm running a code using pyopengl and have some problems of calling glCreate* functions.
The code is running in ubuntu 16.04, python2.7 and the pyopengl version is PyOpenGL 3.1.3b2 and PyOpenGL-accelerate 3.1.3b2 (already the latest versions).
It has the flowing problems:
when I try to call
>>> glCreateTextures
OpenGL.platform.baseplatform.glCreateTextures object at 0x7f16de11a050
It seems that the updated version of pyopengl does add this function (or class) but it's creepy that if I try to give it values for initializing:
>>> glCreateTextures(None,None,None)
Traceback (most recent call last):
File "", line 1, in
File "/media/sinnis/ADDDISK/pyopengl/OpenGL/latebind.py", line 41, in call
return self._finalCall( *args, **named )
File "/media/sinnis/ADDDISK/pyopengl/OpenGL/wrapper.py", line 689, in wrapperCall
result = wrappedOperation( *cArguments )
File "/media/sinnis/ADDDISK/pyopengl/OpenGL/platform/baseplatform.py", line 414, in call
self.name, self.name,
OpenGL.error.NullFunctionError: Attempt to call an undefined function glCreateTextures, check for bool(glCreateTextures) before calling
It seems that the it is checking and considering this call an undefined function. That's how it raises problem in the script texture.py and I find that any glCreate* calls has this problem.
Still no solution to fix this problem. Help!

Related

Failed to run Cognitive-Face-Python-master test

I'm exploring the Face API. I'm using a GUI sample.
GUI link: https://github.com/Microsoft/Cognitive-Face-Python
This error occurs when I run the sample:
Traceback (most recent call last):
File "D:\Tin Central\programming\DOAN\Cognitive-Face-Python-
master\Cognitive-Face-Python-master\sample\view\__init__.py", line 101, in
OnInit
frame = MyFrame(None)
File "D:\Tin Central\programming\DOAN\Cognitive-Face-Python-
master\Cognitive-Face-Python-master\sample\view\__init__.py", line 80, in
__init__
self.book = MyLabelBook(self)
File "D:\Tin Central\programming\DOAN\Cognitive-Face-Python-
master\Cognitive-Face-Python-master\sample\view\__init__.py", line 31, in
__init__
subscription_panel = SubscriptionPanel(self)
File "D:\Tin Central\programming\DOAN\Cognitive-Face-Python-
master\Cognitive-Face-Python-master\sample\view\panel_subscription.py", line
42, in __init__
subgridsizer = wx.GridSizer(rows=2, cols=2)
TypeError: GridSizer(): arguments did not match any overloaded call:
overload 1: 'rows' is not a valid keyword argument
overload 2: 'rows' is not a valid keyword argument
overload 3: not enough arguments
overload 4: not enough arguments
You probably installed wxPython 4, which is still in beta.
You need to install wxPython 3.0.2 by going here: https://sourceforge.net/projects/wxpython/files/wxPython/3.0.2.0/.
Make sure you pick the .exe corresponding to the Python version you have (32-bit or 64-bit).
The full instructions to run the sample app are here.

Can't import wx (wxPython Phoenix) into my script

I'm taking a course in Python, and the current assignment is to convert a previous assignment written in Python 2 (which used wxPython) to Python 3 (which needs Phoenix). I successfully installed Phoenix, and in the Py3 shell I can now import wx just fine. However, if I try to run my actually script, it immediately gets this error:
Traceback (most recent call last):
File "C:\Python27\transferdrillPy3.py", line 10, in
class windowClass(wx.Frame):
NameError: name 'wx' is not defined
What's up with that?
I tried going through my code and deleting every single "wx.", and now it works. I guess Phoenix doesn't need that.

Name 'ftplib' is not defined?

Hey guys I've been cleaning up my old code, and I somehow have problems with declaration of ftplib in except block.
Traceback (most recent call last):
File "PiFtp2.py", line 57, in <module>
except ftplib.all_errors:
NameError: name 'ftplib' is not defined
Here is the Code (the entire code because I have no idea where the problem is):
Link to GitHub
PS: I'd appreciate if someone could tell me how to show code properly on stackoverflow as well :)
In the beginning of the file you imported only the ftp function from ftplib.
Instead of
from ftplib import FTP
use
import ftplib
and then change all FTP function calls from FTP(...) to ftplib.FTP(...) (line 51)

PiCamera cannot be initialized as a class member when the script is run from command prompt

on my Raspberry Pi, I encounter a strange behaviour regarding the use of the PiCamera module.
The following code runs smoothly when either started from IDLE (F5) or from the command prompt ($python test.py)
import picamera
if __name__ == "__main__":
camera=picamera.PiCamera()
camera.close()
But when I put the camera object into a class the code will run only when started from IDLE (F5):
import picamera
class VF:
def __init__(self):
self.camera = picamera.PiCamera()
def __del__(self):
self.camera.close()
if __name__ == "__main__":
myvf = VF()
When I start the above code from the command prompt, I get the following error message:
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
Traceback (most recent call last): File "test.py", line 14, in
myvf = VF()
File "test.py", line 6, in init
self.camera = picamera.PiCamera()
File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line
379, in init
camera_num, self.STEREO_MODES[stereo_mode], stereo_decimate)
File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line
505, in _init_camera
prefix="Camera component couldn't be enabled")
File "/usr/lib/python2.7/dist-packages/picamera/exc.py", line 133,
in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Camera component couldn't be enabled:
Out of resources (other than memory)
The camera module is working correct, I just stripped the code down to the least possible size. Does anybody know this problem, or a similar problem, and can probably provide a solution? The Python Version is 2.7 and the Raspberry Rasbiab-System is completely up to date.
Thanks in advance.
I struggled with this one for hours, and kept getting the "out of resources" error. I finally figured out that in my take-the-picture function, I needed to make sure I did it like this:
camera = PiCamera()
(...camera settings here...)
camera.capture(myfileName)
camera.close()
If I didn't do the close(), I'd get that error every time.
So make sure that camera.close() is getting called right after the 'snap'. It solved the problem for me.
Found out, that the camera-module is not properly shut down when the destructor is not explicitly called (had LED turned off, so didn't see this).
IDLE handles a running camera by somehow resetting it before the script starts, but not the python interpreter.
So everything is ok now when the destructor is called before the script ends.

definition of qwtplot

it's my first post, hope to not break something :).
On windows there are two versions of python2.7, 32 bit and 64 bit both with pyqt and qwt5
i'm trying pyqt from some week, today i tried to use my python/pyqt/pyqwt code written on linux, on windows, but the prompt says:
C:\Users\bomba\Desktop\conversione_python\guibms>python-32 interfaccia_mark3.2.p
y
Traceback (most recent call last):
File "interfaccia_mark3.2.py", line 14, in <module>
from PyQt4.Qwt5.qplt import *
File "C:\Python27-32bit\lib\site-packages\PyQt4\Qwt5\qplt.py", line 95, in <mo
dule>
Y1 = Left = QwtPlot.yLeft
NameError: name 'QwtPlot' is not defined
someone could explain me this?
I would really apppreciate
You haven't defined the Qwtplot object.
Try using:
import PyQt4.Qwt5 as Qwt
plot = Qwt.QwtPlot()
and then use the plot object as you wish.