psychopy.org | Reference | Downloads | Github

HTML export error - ValueError: stat: path too long for Windows

URL of experiment: https://gitlab.pavlovia.org/zbretton/online_recoblast

Description of the problem: Similar to the post found here (ValueError: stat: path too long for Windows) - When I try to export the HTML of my Builder made experiment to upload it to Pavoliva, I get thrown the “ValueError: stat: path too long for Windows”

In that thread @jon suggested adding a line to the code located in:

C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\experiment_experiment.py

So that he could see the output of the error. When that is added, it seems like it’s trying to export part of my custom code as the file name, which is driving this error. But for the life of me I cannot seem to resolve it, and thus cannot get a full version of my experiment online.

Here is the error log I get:

Welcome to PsychoPy3!
v2020.1.3
20.2626     INFO     Loaded monitor calibration from ['2020_05_21 11:33']
Generating PsychoJS script...

C:\Users\zhbre\Desktop\online_recoblast\code
C:\Users\zhbre\Desktop\online_recoblast\Auto->JS
C:\Users\zhbre\Desktop\online_recoblast
C:\Users\zhbre\Desktop\online_recoblast
C:\Users\zhbre\Desktop\online_recoblast
C:\Users\zhbre\Desktop\online_recoblast
C:\Users\zhbre\Desktop\online_recoblast
C:\Users\zhbre\Desktop\online_recoblast\thisExp=psychoJS.experiment;
win=psychoJS.window;
event=psychoJS.eventManager;
Array.prototype.append = [].push;
Object.prototype.upper = "".toUpperCase;
shuffle = util.shuffle;

randint = function(min, maxplusone) {
  return Math.floor(Math.random() * (maxplusone - min) ) + min;
}

C:\Users\zhbre\Desktop\online_recoblast
C:\Users\zhbre\Desktop\online_recoblast
C:\Users\zhbre\Desktop\online_recoblast
C:\Users\zhbre\Desktop\online_recoblast
C:\Users\zhbre\Desktop\online_recoblast\code_init
C:\Users\zhbre\Desktop\online_recoblast\Auto->JS
Traceback (most recent call last):
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py", line 74, in generateScript
    compileScript(infile=exp, version=None, outfile=filename)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py", line 245, in compileScript
    _makeTarget(thisExp, outfile, targetOutput)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py", line 217, in _makeTarget
    script = thisExp.writeScript(outfile, target=targetOutput, modular=True)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\_experiment.py", line 209, in writeScript
    localDateTime, modular)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\components\settings\__init__.py", line 516, in writeInitCodeJS
    self.prepareResourcesJS()
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\components\settings\__init__.py", line 504, in prepareResourcesJS
    resourceFiles = self.exp.getResourceFiles()
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\_experiment.py", line 830, in getResourceFiles
    thisFile = getPaths(thisParam.val)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\_experiment.py", line 755, in getPaths
    if os.path.isfile(thisFile['abs']):
  File "C:\Program Files\PsychoPy3\lib\genericpath.py", line 30, in isfile
    st = os.stat(path)
ValueError: stat: path too long for Windows

I really could use some help on resolving this issue, because I have been wanting to troubleshoot some of the custom code I have written to be used online

The solution top this in previous iterations is that a name is conflicting. My guess is that since code in your code block is creating a variable called filename or thisExp or similar. Try using different names for the variables in your code component