# Error exporting HTML files

**URL:** <https://discourse.psychopy.org/t/error-exporting-html-files/6932>\
**Category:** Builder\
**Tags:** online\
**Created:** [March 6, 2019, 6:00pm UTC](https://discourse.psychopy.org/t/error-exporting-html-files/6932 "2019-03-06T18:00:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlos](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/carlos/32/2701_2.png) [@carlos](https://discourse.psychopy.org/u/carlos)\
**Post date:** [March 6, 2019, 6:00pm UTC](https://discourse.psychopy.org/t/error-exporting-html-files/6932/1 "2019-03-06T18:00:20Z")

</div>

Hi everyone

**OS** : Win10  
**PsychoPy version** : PsychoPy 3.0.5  
**Standard Standalone?** : Yes. Using the Builder.  
**What are you trying to achieve?:** I have an experiment in which I present shapes and participants have to react to them. I am trying to export this to HTML to run it online. When running in PsychoPy, it doesn’t crash. I have used to Builder to create the experiment.

**What did you try to make it work?:** After reading previous posts, I made sure that I had git installed. I also tried to export the experiment without a code component (written both in Python and Java), just to make sure it wasn’t because of that.

\*\*What specifically went wrong when you tried that?: I get the following error:

```auto
Traceback (most recent call last):
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py", line 1682, in fileExport
    target="PsychoJS")
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py", line 2237, in generateScript
    def _getHtmlPath(self, filename):
  File "C:\Program Files (x86)\PsychoPy3\lib\subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "C:\Program Files (x86)\PsychoPy3\lib\subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['C:\\Program Files (x86)\\PsychoPy3\\pythonw.exe', '-m', 'psychopy.scripts.psyexpCompile', 'H:\\Behavioral\\IdeoInst\\Online\\ObservAct\\ObservAct.psyexp', '-o', 'H:\\Behavioral\\IdeoInst\\Online\\ObservAct\\html\\ObservAct.js', '-v', 'latest']' returned non-zero exit status 120.

```

Any help is much appreciated!

---

<div class="post-metadata">

**Author:** ![dvbridges](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dvbridges/32/1918_2.png) [@dvbridges](https://discourse.psychopy.org/u/dvbridges)\
**Post date:** [March 6, 2019, 6:45pm UTC](https://discourse.psychopy.org/t/error-exporting-html-files/6932/2 "2019-03-06T18:45:59Z")

</div>

Hi, try switching your version in Experiment Settings from ‘latest’ to 3.0.5. I suggest this because that line in my standalone relates to version parameters and I also get a logging error when using ‘latest’.

---

<div class="post-metadata">

**Author:** ![carlos](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/carlos/32/2701_2.png) [@carlos](https://discourse.psychopy.org/u/carlos)\
**Post date:** [March 7, 2019, 8:46am UTC](https://discourse.psychopy.org/t/error-exporting-html-files/6932/3 "2019-03-07T08:46:18Z")

</div>

Thanks @dvbridges! that got rid of the error!

I have two further questions:

1. For randomization purposes, I have a couple of .csv files with different trial lists. At the beginning of my experiment, I randomly pick one of these .csv files with a code component (written both in Python and Java). Here’s the java snippet:

```auto
// Begin Experiment

function random_character() {
    var chars = "ABCD";
    return chars.substr( Math.floor(Math.random() * 2), 1);
}

condition = random_character();

```

Then, in the “condition” box of my main routine, I load the corresponding .csv file:

```auto
'design_' + $condition + '.csv'

```

When running in PsychoPy, this works fine. However, when I try to export, I get the following error:

```auto
Traceback (most recent call last):
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py", line 1682, in fileExport
    target="PsychoJS")
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py", line 2242, in generateScript
    else:
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py", line 51, in compileScript
    script = thisExp.writeScript(outfile, target=targetOutput, modular=True)
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\experiment\_experiment.py", line 201, in writeScript
    self.settings.writeInitCodeJS(script, self.psychopyVersion, localDateTime, modular)
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\experiment\components\settings\ __init__.py", line 497, in writeInitCodeJS
    self.prepareResourcesJS()
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\experiment\components\settings\ __init__.py", line 486, in prepareResourcesJS
    resourceFiles = self.exp.getResourceFiles()
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\experiment\_experiment.py", line 790, in getResourceFiles
    condsPaths = findPathsInFile(params['conditionsFile'].val)
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\experiment\_experiment.py", line 743, in findPathsInFile
    filePath = eval(filePath)
  File "<string>", line 1
    'Block_' + $condition + '.csv'
               ^
SyntaxError: invalid syntax

```

I get that the way of calling the condition variable is not working, but, any ideas on how to properly call it?

1. If my .psyexp file is in a different drive from C:, then I get the following error when trying to import to html (the experiment runs in psychopy smoothly):

```auto
Traceback (most recent call last):
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py", line 1682, in fileExport
    target="PsychoJS")
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py", line 2242, in generateScript
    else:
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py", line 51, in compileScript
    script = thisExp.writeScript(outfile, target=targetOutput, modular=True)
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\experiment\_experiment.py", line 201, in writeScript
    self.settings.writeInitCodeJS(script, self.psychopyVersion, localDateTime, modular)
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\experiment\components\settings\ __init__.py", line 497, in writeInitCodeJS
    self.prepareResourcesJS()
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\experiment\components\settings\ __init__.py", line 486, in prepareResourcesJS
    resourceFiles = self.exp.getResourceFiles()
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\experiment\_experiment.py", line 801, in getResourceFiles
    thisFile = getPaths(thisParam.val)
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\experiment\_experiment.py", line 722, in getPaths
    thisFile['rel'] = os.path.relpath(filePath, srcRoot)
  File "C:\Program Files (x86)\PsychoPy3\lib\ntpath.py", line 586, in relpath
    path_drive, start_drive))
ValueError: path is on mount 'C:', start on mount 'H:'

```

If I copy the folder of the experiment to C:, then I can convert to html just fine, but I was wondering if it would be possible to convert from different drives…

Thanks!

---

<div class="post-metadata">

**Author:** ![dvbridges](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dvbridges/32/1918_2.png) [@dvbridges](https://discourse.psychopy.org/u/dvbridges)\
**Post date:** [March 7, 2019, 11:25am UTC](https://discourse.psychopy.org/t/error-exporting-html-files/6932/4 "2019-03-07T11:25:38Z")

</div>

Great, I have added a [GitHub issue](https://github.com/psychopy/psychopy/issues/2327) to get this fixed for next release.

The first new error is because the dollar sign needs to start at the beginning of the line. It tells PsychoPy that this is a line of code, not that it is a variable that needs evaluating. So use:

`$'Block_' + condition + '.csv'`

Hmm not come across this error before, trying to output the html to a different drive. We could raise an issue on GitHub for this one.

---

<div class="post-metadata">

**Author:** ![carlos](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/carlos/32/2701_2.png) [@carlos](https://discourse.psychopy.org/u/carlos)\
**Post date:** [March 7, 2019, 1:10pm UTC](https://discourse.psychopy.org/t/error-exporting-html-files/6932/5 "2019-03-07T13:10:52Z")

</div>

thanks @dvbridges! that again solved the problem
