UnicodeDecodeError
I have a script sent to me I wish to run on OpenSesame. I installed the software from the main download site (as an exe. file not the zip and run type), and pret ty much used wizard to do the rest on my desktop (can't say I needed a username as such during the installation process - just set the file directory and that was it).
The programme runs fine. I have a script I wish to run (an experiment), however, when I try to run the script (either by clicking on the file or opening it in OS) I am presented with this:
Failed to open the file for the following reason:
Failed to open the file for the following reason:
Failed to open file
Details
item-stack: ``
time: Mon Dec 31 13:04:14 2018
exception type: UnicodeDecodeError
exception message: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
Traceback (also in debug window)
File "C:\Users\User\Desktop\OpenSesame\lib\site-packages\libqtopensesame\qtopensesame.py", line 730, in open_file
experiment_path=os.path.dirname(path)
File "C:\Users\User\Desktop\OpenSesame\lib\site-packages\libqtopensesame\items\experiment.py", line 88, in init
workspace=base_python_workspace(self)
File "C:\Users\User\Desktop\OpenSesame\lib\site-packages\libopensesame\experiment.py", line 149, in init
string = self.open(string)
File "C:\Users\User\Desktop\OpenSesame\lib\site-packages\libopensesame\experiment.py", line 640, in open
f = osexpreader(self, src)
File "C:\Users\User\Desktop\OpenSesame\lib\site-packages\libopensesame\osexpfile_osexpreader.py", line 57, in init
self._read_scriptfile()
File "C:\Users\User\Desktop\OpenSesame\lib\site-packages\libopensesame\osexpfile_osexpreader.py", line 118, in _read_scriptfile
self._script = fd.read()
File "C:\Users\User\Desktop\OpenSesame\lib\codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
I've ensured file name has no special characters, as is my opensesame username in the programme? I also tried placing the script file in the opensesame folder directory - no luck. My operating system is 64 bit - I have downloaded the correct installation package. Lastly, I struggle to find an example script file itself to download for comparison. Only code to run a programme is presented on the website. My question is does anyone know why I cannot open this script, and also, has anyone an script file whereby I can see if I am presented the same error message.
Thank you for your time and patients.
Anthony
Comments
Hi Anthony,
Sounds like the experimental file is corrupted or contains characters that Opensesame can't decode. You can try opening the file in a text editor (maybe you have to unzip the file first). If you can open it, you can try to find the problematic part, but to be frank, this is quite a tedious thing to do. If you have access to the original script, you can try to get a new copy, or start from scratch and write everything yourself.
Sorry,
Eduard