psychopy.org | Reference | Downloads | Github

Export HTML not workig


#1

Hi. I am running PsychoPy v.1.90.0. When i try exporting my experiment to html, a html folder is generated, but there is nothing inside it. I also get the following errors in the cmd window:

"Traceback (most recent call last):
_ File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\app\connections.py”, line 418, in onInstall_
_ self.statusMessage.SetLabel(info)_
_ File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\wx-3.0-msw\wx_core.py”, line 9207, in SetLabel_
_ return core.Window_SetLabel(*args, **kwargs)_
TypeError: String or Unicode type required
Traceback (most recent call last):
_ File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\app\builder\builder.py”, line 1696, in fileExport_
_ target=“PsychoJS”)_
_ File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\app\builder\builder.py”, line 2247, in generateScript_
_ target=target)_
_ File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\experiment_experiment.py”, line 146, in writeScript_
_ self.psychopyVersion, localDateTime)_
_ File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\experiment\components\settings_init_.py”, line 462, in writeInitCodeJS_
_ self.prepareResourcesJS()_
_ File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\experiment\components\settings_init_.py”, line 416, in prepareResourcesJS_
_ infoText = readTextFile(“JS_infoPHP.tmpl”)_
_ File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\experiment\components\settings_init_.py”, line 29, in readTextFile_
_ with open(fullPath, “r”) as f:_
IOError: [Errno 2] No such file or directory: ‘C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\experiment\components\settings\JS_infoPHP.tmpl’"

Any ideas on how i can solve this. Thank you.


#2

I have exactly the same problem, I posted a query back on April 17. No response yet. I’ve tried both versions of psychopy on windows (python 2 and 3) but nothing changes. I get the same error as you. I think there are a suite of files missing that should be installed with psychopy.

“JS_infoPHP.tmpl’” seems to be missing.

When I tried previously written studies that compiled successfully to HTML - with earlier psychopy versions - they no longer compile either. But they still compile with older versions of psychopy - on a different PC.

Best wishes,

George


#3

Hi there,

Sorry for the delay. At a guess, the necessary template file has failed to be packaged into the standalone. You could download it from here:

https://github.com/psychopy/psychopy/tree/master/psychopy/experiment/components/settings

and put it into the appropriate folder:
C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\experiment\components\settings\

Out of interest, are there other tmpl files in that folder, or are they all missing?

I’ll make sure this is fixed in the next release


#4

I’ve think I’ve found and fixed the source of the problem. I think you’ll need all the tmpl files from the link specified above. I’ll try and release 1.90.2 soon with this fixed


#5

Thank you jon for your response… the only file that i have in my program files psychopy folder (settings) is"init.py". i have followed your instructions and copied the files from github in my installation.

Now, something changed. when i try exporting, it exports all files and directories that it should (as per the psychopy documentation). However it does not export the “index.html” file and i still get some attribute error in the cmd window (“Param” object has no attribute “replace”).

I have attached a picture with the error and the files that are generated.

Thank you kindly for your help with this


#6

Thanks Jon,

I also get an output to the html folder now.

I don’t yet get an index.html file, instead I get the following (see below)

My apologies for hijacking this thread, I’ve done this because we both seem to have the same underlying problem.

George


v1.90.1
Traceback (most recent call last):
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\app\builder\builder.py”, line 1696, in fileExport
target=“PsychoJS”)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\app\builder\builder.py”, line 2247, in generateScript
target=target)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\experiment_experiment.py”, line 146, in writeScript
self.psychopyVersion, localDateTime)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\experiment\components\settings_init_.py”, line 469, in writeInitCodeJS
buff.write(header)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\experiment\exports.py”, line 79, in write
io.StringIO.write(self, u"{}".format(text))
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc2 in position 1486: ordinal not in range(128)