Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Error - TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported

I think this is a not a programming specific bug, but is caused by some libraries.

I am transferring my project to a new PC, which I have freshly setup with anaconda etc. using python 3.7.6. Executing the task on the old machine works fine, here I have also used anaconda with python 3.7 (not sure if it was 3.7.6 but I could check this, i just used while creating the environment python=3.7).

When I now try to run my program, I receive:

Exception in Tkinter callback
Traceback (most recent call last):
...    
TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported.

The error is quite long, but it is caused by the following libraries: calling gym.envs which then calls some pyglet.libs

The last line in the error is

...from pyglet.libs.x11 import xlib
  File "...7/lib/python3.7/site-packages/pyglet/libs/x11/xlib.py", line 2928, in <module>
    XEHeadOfExtensionList.argtypes = [XEDataObject]

Thank you for your help! I do not know how to solve this or even start solving it.

like image 722
Dubbox Avatar asked Mar 03 '23 21:03

Dubbox


2 Answers

Downgrade your pyttsx3 version:

pip install pyttsx3==2.71
like image 132
Ishwar Gautam Avatar answered Apr 28 '23 04:04

Ishwar Gautam


It seems like there is simply no support currently for using gym+pyglet in python version 3.7.6+.

The pyglet error is fixed in 1.4.9+ but gym is currently not compatible with those versions.

Still it is possible to simply downgrade python to 3.7.4 and everything works fine as it is supposed to do.

like image 32
Dubbox Avatar answered Apr 28 '23 03:04

Dubbox