psychopy.org | Reference | Downloads | Github

Bug in v3.22 when compiling path delimiters under Linux

In a stimulus component, when I specify the path to an image in a subdirectory (e.g. stimuli/myimage.png) with a forward slash as the path delimiter as required under Linux, the experiment crashes.

The error message in the output window looks like
"OSError: Couldn’t find image stimuli\myimage.png; check path? (tried: /home/…/stimuli\myimage.png)

Compiling the builder script and looking at the result in coder I find that the forward slash has been converted to a double backslash. After editing this to replace the two backshlashes with a single forward slash the python script works.

Well, this bug is still there in 3.2.3. Does no one else ever transfer .psyexec files from WIndows to Linux or vice versa, or is my observation due to a unique glitch in my installation?

Hi @Detlef, I have just created a new task on a Linux machine running Ubuntu 18.04 and the path format seems correct (all forward slashes). Would you mind sharing your task so I can test on this machine?

Hi @Detlef, I think one issue is that you have used backslash characters as your path separators in your image components e.g., in Bisection routine, your image component called TexturePreview_11 has a stim path of stimuli\noise_000.png. On Linux, you should use forward slash path separators e.g., stimuli/noise_000.png. Try changing all of your paths and give it another go.

That’s embarrassing. However, I explicitely mentioned in my bug report that I had actually used forward slashes. That you see backward slashes may point into the right direction. My worklflow is that I make the builder scripts on my office pc under Windows, then transfer the files to a Linux machine in the lab and change the backslashes to forward slashes. I assure you that everything looked good in the Linux builder gui, but I nevertheless got the error.
Now after your post I opened the .psychexec file in the lab and found one (!) backslash. I edited that again and ran the script. The error was there again, but now for another image stimulus. So I edited that path again. I was not very systematic because initially I thought I overlooked something, but I think I had to edit and save and reload the script into builder maybe two or three times until I got rid of the error.
In a nutshell I suspect that the file from Windows was not (always) updated internally when I changed the backslashes in the gui, and thus they reappeared when the file was freshly loaded. I believe this is what you experienced when you opened my file. Does that make sense?