Problem during initializing
Hi!
I am running into a problem while initializing expyriment.
I get this error:
File "S:/.....y", line 20, in <module> exp = control.initialize() File "S:\....\venv\lib\site-packages\expyriment\control\_experiment_control.py", line 438, in initialize no_frame=defaults.window_no_frame) File "S:\p....\venv\lib\site-packages\expyriment\io\_screen.py", line 123, in init if "ARB_texture_non_power_of_two" not in ogl_extensions: TypeError: a bytes-like object is required, not 'str'
from expyriment import control, stimuli, design, misc, io control.set_develop_mode(False) ..... exp = control.initialize()
I have also tried adding this but I still get the same error:
control.defaults.window_no_frame = True
The script was running perfectly on my computer and now I am trying to run it through remote desktop and I get the error.
Thank you!
Comments
Hi,
Windows' remote desktop seems to use a weird virtual video card implementation. We have seen problems with remote desktop before, and generally don't advise to use Expyriment with remote desktop.
In your particular case, however, it seems that you are using a version of PyOpenGL that is lower than 2.2. Updating PyOpenGL to a current version (>3) would at least help with the specific error you are seeing.
The reason for this error is that in Python 3, strings are Unicode, but when transmitting on the network, the data needs to be bytes instead. We can convert bytes to string using bytes class decode() instance method, So you need to decode the bytes object to produce a string. In Python 3 , the default encoding is "utf-8" , so you can use directly:
b"python byte to string".decode("utf-8")Python makes a clear distinction between bytes and strings . Bytes objects contain raw data — a sequence of octets — whereas strings are Unicode sequences . Conversion between these two types is explicit: you encode a string to get bytes, specifying an encoding (which defaults to UTF-8); and you decode bytes to get a string. Clients of these functions should be aware that such conversions may fail, and should consider how failures are handled.