psychopy.org | Reference | Downloads | Github

Can’t run experiments, got a ValueError: embedded null byte

Hello,

I am very new to PsychoPy and get stuck at the very beginning. I’m trying to start with a simple “Hello World” but nothing happened after I click the Running button. I checked the output in the coder view and it shows a ValueError: embedded null byte. I have no idea what does it mean and what is the issue here. : (


I’m using:
Win 7
PsychoPy version:v 3.1.2

Thanks in advance
Ran

Hi @Ran_Ma, could you please copy and paste the whole error message?

Thank you for your reply! Sure! Here it is:

Traceback (most recent call last):
File “F:\software2\Psychopy\lib\site-packages\psychopy\app\builder\builder.py”, line 2127, in runFile
self.generateScript(fullPath) # Build script based on current version selected
File “F:\software2\Psychopy\lib\site-packages\psychopy\app\builder\builder.py”, line 2353, in generateScript
psyexpCompile.compileScript(infile=self.exp, version=None, outfile=experimentPath)
File “F:\software2\Psychopy\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 195, in compileScript
_makeTarget(thisExp, outfile, targetOutput)
File “F:\software2\Psychopy\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 174, in _makeTarget
script = thisExp.writeScript(outfile, target=targetOutput)
File “F:\software2\Psychopy\lib\site-packages\psychopy\experiment_experiment.py”, line 187, in writeScript
localDateTime = data.getDateStr(format="%B %d, %Y, at %H:%M")
File “F:\software2\Psychopy\lib\site-packages\psychopy\data\utils.py”, line 573, in getDateStr
now = time.strftime(format, time.localtime())
ValueError: embedded null byte

I just tried to run a Hello World demo in the Coder view. And it does worked. I don’t know why it doesn’t work in the builder view. :frowning:

This is another error message when I try to run the Pump buider demo:

Traceback (most recent call last):
File “F:\software2\Psychopy\lib\site-packages\psychopy\app\builder\builder.py”, line 2127, in runFile
self.generateScript(fullPath) # Build script based on current version selected
File “F:\software2\Psychopy\lib\site-packages\psychopy\app\builder\builder.py”, line 2353, in generateScript
psyexpCompile.compileScript(infile=self.exp, version=None, outfile=experimentPath)
File “F:\software2\Psychopy\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 195, in compileScript
_makeTarget(thisExp, outfile, targetOutput)
File “F:\software2\Psychopy\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 174, in _makeTarget
script = thisExp.writeScript(outfile, target=targetOutput)
File “F:\software2\Psychopy\lib\site-packages\psychopy\experiment_experiment.py”, line 187, in writeScript
localDateTime = data.getDateStr(format="%B %d, %Y, at %H:%M")
File “F:\software2\Psychopy\lib\site-packages\psychopy\data\utils.py”, line 573, in getDateStr
now = time.strftime(format, time.localtime())
ValueError: embedded null byte

It is highly unusual to get errors like these (that occur when Builder is trying to generate the experiment script). The good news is it isn’t likely to be due to anything you have done when creating the experiment, and it shouldn’t affect any written manually in the Coder view.

I think this is actually due to an operating system error: I see you are using Windows 7. It is possible that this error might be resolved by updating Windows (not necessarily to a whole new version, but just apply any updates to version 7 that are available). This was likely a Windows issue that affected Python more widely, not just PsychoPy:

Thank you so much for your reply! I was so worried about it. Now finally see some hope to solve it. :smile: Thanks again!

updating:
tried on another laptop (Windows 10), this issue doesn’t happen again! :smile:

when this issue happended in my project,I tried to chage the “use psychopy version” item to “3.1” in "Experimental settings " tool,and now it works well. ps:My os is win7 but I didn’t update it.
So I think there may be some compile issues when compile the experiments to python script while use some special psychopy version like 3.2.4.
I hope this method will be helpful,and this bug will be fixed in next new version.


psychopy_error