Cannot run a project with pyglet
Describe the bug As soon as I run the app:
Traceback (most recent call last):
File "D:\PycharmProjects\GameTemplate\main.py", line 1, in <module>
import arcade
File "D:\PycharmProjects\GameTemplate\venv\Lib\site-packages\arcade\__init__.py", line 146, in <module>
from .joysticks import get_game_controllers
File "D:\PycharmProjects\GameTemplate\venv\Lib\site-packages\arcade\joysticks.py", line 3, in <module>
import pyglet.input
File "D:\PycharmProjects\GameTemplate\venv\Lib\site-packages\pyglet\input\__init__.py", line 150, in <module>
from .win32 import get_devices
File "D:\PycharmProjects\GameTemplate\venv\Lib\site-packages\pyglet\input\win32\__init__.py", line 6, in <module>
from pyglet.input.win32.directinput import _di_manager as _di_device_manager
File "D:\PycharmProjects\GameTemplate\venv\Lib\site-packages\pyglet\input\win32\directinput.py", line 354, in <module>
_di_manager = DIDeviceManager()
^^^^^^^^^^^^^^^^^
File "D:\PycharmProjects\GameTemplate\venv\Lib\site-packages\pyglet\input\win32\directinput.py", line 221, in __init__
self.set_current_devices()
File "D:\PycharmProjects\GameTemplate\venv\Lib\site-packages\pyglet\input\win32\directinput.py", line 228, in set_current_devices
new_devices, _ = self._get_devices()
^^^^^^^^^^^^^^^^^^^
File "D:\PycharmProjects\GameTemplate\venv\Lib\site-packages\pyglet\input\win32\directinput.py", line 298, in _get_devices
_xinput_devices = get_xinput_guids()
^^^^^^^^^^^^^^^^^^
File "D:\PycharmProjects\GameTemplate\venv\Lib\site-packages\pyglet\input\win32\xinput.py", line 306, in get_xinput_guids
hr = locator.ConnectServer(name_space, None, None, 0, 0, None, None, byref(services))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\PycharmProjects\GameTemplate\venv\Lib\site-packages\pyglet\libs\win32\com.py", line 185, in pinterface_method_forward
return _m(self, *args)
^^^^^^^^^^^^^^^
File "_ctypes/callproc.c", line 1008, in GetResult
OSError: [WinError -2147217394] Windows Error 0x8004100e
System Information: Win11 (tiny11) - Intel i5-4670K - 21GB RAM - GTX1080Ti Pycharm 2024.2.3 CE as IDE Python versions tried: 3.10, 3.12, 3.13 Pyglet versions tried: 2.1.dev2, 2.1.dev7
How To Reproduce Make new project. Import Arcade. Pyglet will install as a dependency. Import arcade. Run (the project) as you watch the world crumble before you
Thanks for the report! Looks like your Windows install is either blocking the WMI query, missing something, or corrupt. I will add some checks to bail out of the function if it fails.
For now you can bypass XInput by calling:
import pyglet
pyglet.options["win32_disable_xinput"] = True
At the top of your file to disable xinput.
Hi! It was partially solved. I could run the project with 3.10, but on 3.13 it outputs:
Traceback (most recent call last):
File "D:\PycharmProjects\CELESTE2\main.py", line 1, in <module>
import globals as g
File "D:\PycharmProjects\CELESTE2\globals.py", line 3, in <module>
import arcade
File "D:\PycharmProjects\CELESTE2\.venv\Lib\site-packages\arcade\__init__.py", line 94, in <module>
from .sections import Section, SectionManager
File "D:\PycharmProjects\CELESTE2\.venv\Lib\site-packages\arcade\sections.py", line 9, in <module>
from arcade.camera.default import DefaultProjector
File "D:\PycharmProjects\CELESTE2\.venv\Lib\site-packages\arcade\camera\__init__.py", line 27, in <module>
from arcade.camera.camera_2d import Camera2D
File "D:\PycharmProjects\CELESTE2\.venv\Lib\site-packages\arcade\camera\camera_2d.py", line 21, in <module>
from arcade.gl import Framebuffer
File "D:\PycharmProjects\CELESTE2\.venv\Lib\site-packages\arcade\gl\__init__.py", line 20, in <module>
from .context import Context
File "D:\PycharmProjects\CELESTE2\.venv\Lib\site-packages\arcade\gl\context.py", line 22, in <module>
import pyglet.gl.lib
File "D:\PycharmProjects\CELESTE2\.venv\Lib\site-packages\pyglet\gl\__init__.py", line 191, in <module>
from .win32 import Win32Config as Config
File "D:\PycharmProjects\CELESTE2\.venv\Lib\site-packages\pyglet\gl\win32.py", line 6, in <module>
from pyglet.display.win32 import Win32Canvas
File "D:\PycharmProjects\CELESTE2\.venv\Lib\site-packages\pyglet\display\__init__.py", line 44, in <module>
from pyglet.display.win32 import Win32Display as Display
File "D:\PycharmProjects\CELESTE2\.venv\Lib\site-packages\pyglet\display\win32.py", line 3, in <module>
from pyglet.libs.win32 import _user32, _shcore, _gdi32
File "D:\PycharmProjects\CELESTE2\.venv\Lib\site-packages\pyglet\libs\win32\__init__.py", line 6, in <module>
from . import com
File "D:\PycharmProjects\CELESTE2\.venv\Lib\site-packages\pyglet\libs\win32\com.py", line 226, in <module>
class IUnknown(Interface):
...<4 lines>...
]
File "D:\PycharmProjects\CELESTE2\.venv\Lib\site-packages\pyglet\libs\win32\com.py", line 154, in __new__
_pInterfaceMeta(f"p{name}", (ctypes.POINTER(bases[0]),), {'_type_': res_type})
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: _type_ must have storage info
There is an issue #1196 exactly talking abt this, yet it is closed as fixed it seems.
Are you using the latest version of arcade? pip install arcade==3.0.0.dev37 should take care of that.
That version seems to have bumped the pyglet dependency to 2.1.dev6, which should be the first of the dev versions containing the fix (at least going by their release dates on pypi). (The release version and pypi version differ by 1 for some reason, but the release dates match.) If you are using any earlier version, pyglet will contain an outdated COM module which will fail on Python 3.13.
No, dev37 was the culprit. I had to build arcade 3.0.0.dev38 (3w ago release) myself to make it work. It works with the last public pyglet release without any hiccups
I am not really familiar with gh issues as i don't stick around here often, I think i solved the problem on my end and could probably close this thread, but i do hesitate, in case someone needs any more info about this particular bug(?). If not, feel free to close it if you are able to.
If you can run the project now, i'd say feel free to close the issue. The text in it will remain searchable either way for anyone else running into these errors.
The first one is rather unusual, and from two links ([1], [2]) i could dig up on the error (WBEM_E_INVALID_NAMESPACE while looking up root/cimv2) sounds like the result of a misconfiguration of your Windows installation. The latter error is definitely caused by the recency of Python 3.13 and the fact the packages and dependencies didn't get updated all that quickly.