psychopy.org | Reference | Downloads | Github

Unable to export HTML

Hi, I tried File - Export HTML for the same Builder experiment in both Mac and Windows but got the following error. The funny thing is that this experiment was downloaded from one that’s on Pavlovia already (with an accompanying .psyexp file) yet could not be exported again to the online version (html, js…).

Any help would be much appreciated.

Traceback (most recent call last):
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 719, in fileExport
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 73, in generateScript
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 242, in compileScript
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 214, in _makeTarget
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 212, in writeScript
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/settings/__init__.py”, line 527, in writeInitCodeJS
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/settings/__init__.py”, line 515, in prepareResourcesJS
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 830, in getResourceFiles
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 818, in findPathsInFile
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 801, in findPathsInFile
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 759, in getPaths
TypeError: object of type ‘float’ has no len()

That’s a strange one… It looks like the only path in your file is being interpreted as a float rather than a string, could you share the .psyexp? I’ll try and track down what is being misread so we can account for this in future

You can find the link to the folder (with the builder file in it) hyperlinked to “one” in my original post. Here’s for quick reference: https://gitlab.pavlovia.org/tonytbui/Gamble_task.git

Hi @TParsons,

I am having similar issues although the error it throws is slightly different. It still compiled fine this morning and now that I finished a new experiment it refuses to compile:

10.5490     ERROR     invalid syntax (<unknown>, line 2)
2020-10-12 22:00:05.468 python[76257:12440805] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
Traceback (most recent call last):
  File "runpy.pyc", line 193, in _run_module_as_main
  File "runpy.pyc", line 85, in _run_code
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py", line 250, in <module>
    compileScript(args.infile, args.version, args.outfile)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py", line 242, in compileScript
    _makeTarget(thisExp, outfile, targetOutput)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py", line 214, in _makeTarget
    script = thisExp.writeScript(outfile, target=targetOutput, modular=True)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py", line 251, in writeScript
    self_copy._currentRoutine.writeRoutineBeginCodeJS(script, modular)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/routine.py", line 277, in writeRoutineBeginCodeJS
    thisCompon.writeRoutineStartCodeJS(buff)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/_base.py", line 202, in writeRoutineStartCodeJS
    self.writeParamUpdatesJS(buff, 'set every repeat')
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/_base.py", line 405, in writeParamUpdatesJS
    target="PsychoJS")
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/_base.py", line 399, in writeParamUpdates
    target=target)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/_base.py", line 435, in writeParamUpdate
    valStr = str(val).strip()
TypeError: __str__ returned non-string (type NoneType)
357.9079     INFO     /Applications/PsychoPy.app/Contents/MacOS/python -m psychopy.scripts.psyexpCompile /Users/pssa5c/Dropbox/Bangor/Codes/InteractionPattern/Version_2/PsychoPyVersion2.1/ActionUnderstanding2_new.psyexp -o /Users/pssa5c/Dropbox/Bangor/Codes/InteractionPattern/Version_2/PsychoPyVersion2.1/html/ActionUnderstanding2_new.js -v 2020.2

A slightly earlier version of the experiment using 2020.1 (which the new one is based on but I changed to the newest version) still works fine to compile though. Any help would be much appreciated.

Just to add what the problem may be (at least in my case), when copying whole routines from an experiment that was created using 2020.1 to an experiment that is supposed to run as 2020.2 it fails to compile.
Copying single components seems to be affected as well, although I feel like this is not true for code components.

Also when I attempting to copy things between experiments, I get the following error in a separate pop-up window

Traceback (most recent call last):
  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/wx/lib/agw/aui/auibook.py”, line 2427, in OnMotion
wx._core.wxAssertionError: C++ assertion “x > (double)(-2147483647 -1) - 0.5 && x < (double)2147483647 + 0.5” failed at /Users/robind/projects/bb2/dist-osx-py36/build/ext/wxWidgets/include/wx/math.h(140) in wxRound(): argument out of supported range

I think these are both the same problem - there is some value somewhere in your experiment which is not convertible to a string, causing an error both when compiling to JS and when copying between experiments. @tonytbui, when I follow the link it says file not found, have you recently moved or renamed your experiment? @Julia_Landsiedel if you could also post your .psyexp file it would be helpful too as I could look for illegal characters, instances from external packages, etc. and try to track down what the str function doesn’t like :slight_smile:

@Julia_Landsiedel it looks like, in your mainText you had set the text to be

#$TaskInstructions;
$tempInstructions; 

as a way to comment out the other instruction text. Actually, $ doesn’t really mean “this is a variable” it means “treat this box as code”. PsychoPy does it’s best to interpret that correctly but this time it was confused when trying to move that to JavaScript! :wink:

If you change your entry to maintext to be this:

$#TaskInstructions
tempInstructions

does that fix the problem?

We’ll try to work out how to tell PsychoPy to interpret your code the way you intended but it might be tricky! :slight_smile: