psychopy.org | Reference | Downloads | Github

Resources are not found in local debugging

URL of experiment:

PsychoPy Version:
2020.1.1

PsychoJS Version:
2020.1

Description of the problem:
Both of these demos run on Pavlovia server without any issue. Because I want to test new local debugging feature, I run these demos from “Run JS for local debug” button on the Runner view. However, demos stopped with following error.

1

I tried FireFox and Chrome on Windows10 and FireFox on Ubuntu 18.04LTS, but the result was the same. I opened debug window on Firefox and found following log message. It seems that no resource files are downloaded.

DEBUG unknown | signal: {"message":"RESOURCES_REGISTERED","count":0} [log4javascript.min.js:1:40074](https://cdnjs.cloudflare.com/ajax/libs/log4javascript/1.4.9/log4javascript.min.js)
DEBUG unknown | downloading the registered resources for experiment: Score_demo [log4javascript.min.js:1:40074](https://cdnjs.cloudflare.com/ajax/libs/log4javascript/1.4.9/log4javascript.min.js)
DEBUG unknown | signal: {"message":"DOWNLOAD_COMPLETED"}

Then, script stopped at getResource().
this._resources was empty at this time. so this._resources.get(name) returned 'undefined'.

{…}
context: "when importing condition: conditions.xlsx"
error: Object { origin: "ServerManager.getResource", context: "when getting the value of resource: conditions.xlsx", error: "unknown resource" }
origin: "TrialHandler.importConditions"
<prototype>: Object { … }
[core-2020.1.js:1437:12](http://localhost:12002/lib/core-2020.1.js)
onerror http://localhost:12002/lib/core-2020.1.js:1437

FATAL unknown | {"origin":"TrialHandler.importConditions","context":"when importing condition: conditions.xlsx","error":{"origin":"ServerManager.getResource","context":"when getting the value of resource: conditions.xlsx","error":"unknown resource"}} [log4javascript.min.js:1:40074](https://cdnjs.cloudflare.com/ajax/libs/log4javascript/1.4.9/log4javascript.min.js)
append https://cdnjs.cloudflare.com/ajax/libs/log4javascript/1.4.9/log4javascript.min.js:1
doAppend https://cdnjs.cloudflare.com/ajax/libs/log4javascript/1.4.9/log4javascript.min.js:1
callAppenders https://cdnjs.cloudflare.com/ajax/libs/log4javascript/1.4.9/log4javascript.min.js:1
log https://cdnjs.cloudflare.com/ajax/libs/log4javascript/1.4.9/log4javascript.min.js:1
fatal https://cdnjs.cloudflare.com/ajax/libs/log4javascript/1.4.9/log4javascript.min.js:1
dialog http://localhost:12002/lib/core-2020.1.js:920
onerror http://localhost:12002/lib/core-2020.1.js:1438

I’m not sure whether this is bug or my fault (something wrong with my experiments and/or my PC setup). What should I do to use local debugging?

I noticed that, in html/Score_demo.js, psychoJS.start() is called as follows.

psychoJS.start({
  expName: expName,
  expInfo: expInfo,
  });

On the other hand, when running on Pavlovia, call of psychoJS.start() is as follows (confirmed by showing debugger pane on FireFox).
Name and path of xlsx file is given.

psychoJS.start({expName, expInfo, resources: [
  {'name': 'conditions.xlsx', 'path': 'resources/conditions.xlsx'}
]
});

In addition, when running on Pavlovia, Score_demo.js seems to import version 3.2 of PsychoJS.

import { PsychoJS } from './lib/core-3.2.js';
import * as core from './lib/core-3.2.js';
import { TrialHandler } from './lib/data-3.2.js';
import { Scheduler } from './lib/util-3.2.js';
import * as util from './lib/util-3.2.js';
import * as visual from './lib/visual-3.2.js';
import { Sound } from './lib/sound-3.2.js';

On local debugging, Score_demo.js imports version 2020.1.

import { PsychoJS } from './lib/core-2020.1.js';
import * as core from './lib/core-2020.1.js';
import { TrialHandler } from './lib/data-2020.1.js';
import { Scheduler } from './lib/util-2020.1.js';
import * as util from './lib/util-2020.1.js';
import * as visual from './lib/visual-2020.1.js';
import * as sound from './lib/sound-2020.1.js';

@hsogo12600, just took a look, and the issue is that resource file paths are only written in the new PsychoPy when no html output folder exists in the Experiment Settings. If you clear the html output folder in Experiment Settings, so it is blank, then recompile and rerun the task locally, but also refreshing the browser cache to remove the previously uploaded file, this should run correctly.

I think this is a bug, because running locally is dependent on the html output path being blank.

2 Likes

Thank you for information! I confirmed that local debugging worked if removing the “html output folder” setting and recompile html output. But, on the other hand, online experiment doesn’t work after sync. :worried:

I think this is one of the problems, if you change the html output folder after you have created your project on Pavlovia, the project resources cannot be found. Perhaps the easiest solution will be to generate separate output files for local debugging, so they can contain the resource paths independent of the html output path.

Putting output files both in project folder and html folder, local debugging and online experiment worked. It is good to know that html output folder can’t be changed after project is created on Pavlovia.

1 Like