So, The other day, I went back to an old project to finish it but when I tried running it, it gave me several errors that I've tried to fix but some of them I don't know how to fix. The program worked fine when I stopped working on it, so I'm very confused at what happened. My guess is that pyglet got a new update and removed a lot of stuff I used to use. Some of the errors I get are as follows
Traceback (most recent call last):
File "C:\Users\____\Desktop\Code\3D\Projects\3D Program 1\main.py", line 9,
in <module>
screen =
pyglet.window.get_platform().get_default_display().get_default_screen()
AttributeError: module 'pyglet.window' has no attribute 'get_platform'
and
Traceback (most recent call last):
File "C:\Users\____\Desktop\Code\3D\Projects\3D Program 1\main.py", line 216, in <module>
main()
File "C:\Users\____\Desktop\Code\3D\Projects\3D Program 1\main.py", line 208, in main
win = Window(caption = "3D Program 1", width = WINW, height = WINH, resizable = False, vsync = True)
File "C:\Users\____\Desktop\Code\3D\Projects\3D Program 1\main.py", line 57, in __init__
self.tex1 = get_tex("steel_tex.png")
File "C:\Users\____\Desktop\Code\3D\Projects\3D Program 1\main.py", line 21, in get_tex
tex = pyglet.image.load(file).texture
AttributeError: 'ImageData' object has no attribute 'texture'
I also had problems with it saying that there was no such thing as the "pyglet.graphics.TextureGroup" class
Yes, it looks like both of snippets of code you show are using features that were deprecated in previous versions of Pyglet and removed in the recent 1.4 release. You can see the deprecation (and their suggested replacements) in the documentation for older versions:
The get_platform() function in pyglet.window:
Deprecated. Use pyglet.canvas.Display.
The .texture attribute of an image:
Deprecated. Use get_texture().
Related
code:
import ColabTurtle.Turtle as tutel
tutel.initializeTurtle()
tutel.forward(10)
error is:
<IPython.core.display.HTML object>
Traceback (most recent call last):
File "f:\stuff\e.py", line 3, in <module>
tutel.forward(10)
File "C:\Users\U.S.E.R\AppData\Local\Programs\Python\Python311\Lib\site-packages\ColabTurtle\Turtle.py", line 174, in forward
_moveToNewPosition(ending_point)
File "C:\Users\U.S.E.R\AppData\Local\Programs\Python\Python311\Lib\site-packages\ColabTurtle\Turtle.py", line 163, in _moveToNewPosition
_updateDrawing()
File "C:\Users\U.S.E.R\AppData\Local\Programs\Python\Python311\Lib\site-packages\ColabTurtle\Turtle.py", line 144, in _updateDrawing
raise AttributeError("Display has not been initialized yet. Call initializeTurtle() before using.")
AttributeError: Display has not been initialized yet. Call initializeTurtle() before using.
basically, it tells me to use intializeturtle() before running a ColabTurtle function. Except, i did already use it.
Help.
Try to run it in Google Collab. If there will be no module ColabTurtle, you need to create a new code (+code) and write
!pip install ColabTurtle
I have created a set of python scripts that scrape information out of a website using Internet Explorer. This methodology while not ideal, is the only way I could get it to work as the site does not work well with other browsers and has single-sign on authentication which was difficult to deal with through requests. Anyways, it works. I'd like to be able to share with coworkers without them needing to install python or modify scripts.
I was able to create an executable of the scripts that works on my computer through pyinstaller. When I share with coworkers, though, the get an error "local variable 'browser' referenced before assignment." I tried referencing the IEWebdriverService.exe the binaries field of the pyinstaller .spec file. This caused the size of the .exe to grow so it did something..but it didn't solve the problem.
This is my first time creating an executable and I have really no idea how the IE Driver works so I'm stuck at the moment. Any help would be greatly appreciated. I'm open to using another tool than pyinstaller if that helps, I just found it the easiest to use of the alternatives. I'm using Python 3.5.
thanks.
Edit - Error Log
run # 1
['Part Number = 12649189']
Error
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.ie.se
rvice.Service object at 0x0000000004D00D30>>
Traceback (most recent call last):
File "site-packages\selenium\webdriver\common\service.py", line 173, in __del_
_
File "site-packages\selenium\webdriver\common\service.py", line 145, in stop
AttributeError: 'Service' object has no attribute 'process'
['Part Number = 12649189']
Error
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.ie.se
rvice.Service object at 0x0000000004D00D30>>
Traceback (most recent call last):
File "site-packages\selenium\webdriver\common\service.py", line 173, in __del_
_
File "site-packages\selenium\webdriver\common\service.py", line 145, in stop
AttributeError: 'Service' object has no attribute 'process'
['Part Number = 12649189']
Error
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.ie.se
rvice.Service object at 0x0000000004D00D30>>
Traceback (most recent call last):
File "site-packages\selenium\webdriver\common\service.py", line 173, in __del_
_
File "site-packages\selenium\webdriver\common\service.py", line 145, in stop
AttributeError: 'Service' object has no attribute 'process'
Traceback (most recent call last):
File "Parent_Part_W_UI.py", line 138, in <module>
File "Parent_Part_W_UI.py", line 23, in __init__
File "Parent_Part_W_UI.py", line 40, in init_window
File "Parent_Part_W_UI.py", line 122, in execute_main
UnboundLocalError: local variable 'browser' referenced before assignment
Using the basic example on their website:
from OCC.Display.SimpleGui import init_display
from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox
display, start_display, add_menu, add_function_to_menu = init_display()
my_box = BRepPrimAPI_MakeBox(10., 20., 30.).Shape()
display.DisplayShape(my_box, update=True)
start_display()
I can't get that to run? Any ideas?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\WinPython-32bit-2.7.6.4\python-2.7.6\lib\site-packages\OCC\Display\SimpleGui.py", line 164, in init_display
win.canva.InitDriver()
File "C:\WinPython-32bit-2.7.6.4\python-2.7.6\lib\site-packages\OCC\Display\pysideDisplay.py", line 79, in InitDriver
self._display = OCCViewer.Viewer3d(self.GetHandle())
File "C:\WinPython-32bit-2.7.6.4\python-2.7.6\lib\site-packages\OCC\Display\pysideDisplay.py", line 55, in GetHandle
return int(self.winId())
TypeError: int() argument must be a string or a number, not 'PyCObject'
That's a duplication of a github issue:
https://github.com/tpaviot/pythonocc-core/issues/68
we need to know which GUI library your using and what verion of pythonocc you are one.
this is an older version of pythonocc, the current you can find here:
Why not try and install that newer version?
Its important that the OCE library you've got installed match.
So pythonocc-core 0.16 goes with OCE 0.16
Using python interpreter and/or pdb, can we run a program and pause whenever reaching an error, so that I can examine all the frames of the call stack of the program at the time of crashing?
When I run a program directly inside python interpreter, when reaching an error, it tells where the line of code it happens, but it seems return to the topmost frame, and I can't examine the frame where the error actually happens. E.g.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "test.py", line 194, in <module>
addlevel(root_toc, 0)
File "test.py", line 191, in addlevel
addlevel(child, root_level+1)
File "test.py", line 188, in addlevel
root.value.append(root_level)
AttributeError: 'str' object has no attribute 'append'
>>> root_level
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'root_level' is not defined
The error happens at the lowest frame, and I can't examine the value of root_level at that frame. Is it because it returns to the topmost frame after the error happens? How can examine the lowest frame?
THanks.
Run pdb as a module, passing the script you want to debug. It will break on abnormal exits. (This is mentioned early in the docs.)
python -m pdb my_script.py
If you're in the interpreter, you can use pdb.pm() to debug the last traceback.
Or, use the IPython interpreter. Typing debug after an uncaught exception will enter a pdb session for the last traceback, similar to pm().
I am trying to run the example file provided here : http://git.videolan.org/?p=vlc/bindings/python.git;a=tree;f=examples;hb=HEAD (the qtvlc example).
It gives me the following error :
$>c:\Python27_32b\python.exe examples_qtvlc.py "test_file.mov"
Traceback (most recent call last):
File "examples_qtvlc.py", line 114, in PlayPause
self.OpenFile()
File "examples_qtvlc.py", line 153, in OpenFile
self.MediaPlayer.set_hwnd(self.VideoFrame.winId())
File "vlc.py", line 2126, in set_hwnd
return libvlc_media_player_set_hwnd(self, drawable)
File "vlc.py", line 4263, in libvlc_media_player_set_hwnd
return f(p_mi, drawable)
ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: wrong type
Traceback (most recent call last):
File "examples_qtvlc.py", line 192, in <module>
sys.exit(app.exec_())
It doesn't give me the error when I run the program, it gives it when I choose a .mov file from the "play" button in the interface.
Btw, if I try to play an .avi file it plays it, but in another window and it gives a "No accelerated IMDCT transform found".
The thing is I really need to be able to play .mov files, it is the only reason I am using the vlc module instead of Phonon available with PyQt.
I was having the same error when I tried to use the vlc module in my code so I thought I was doing something wrong. But if the example file is not working I guess there is something wrong in my config rather than my code. What can cause this error ?
EDIT :
I didn't notice, but if i click "play" again after choosing the file (and getting the error), the file does play... outside of the window.. The problem is that I don't have any control in this new window where the video plays.. What do I have to do to get it to play inside the application ?
The second thing is that I get the following error (repeating as the video plays)
[075e5654] main subpicture error: blending YUVA to J422 failed
I don't know if it important or not ...
SOLVED :
For those who would be interested, I casted the
self.VideoFrame.winId()
as an int and it seems to be doing what I want
Thanks for those who took the time to read this question..