Hi there,
Can someone please help me figure out this TypeError?
URL of experiment: Experiment | zared/dissertation-pilot-procedure (pavlovia.org)
Description of the problem: My experiment ran great on PsychoPy from Builder. However, I’m getting the following TypeError when I pilot it from Pavlovia:
I’m assuming that ‘size’ refers to my adjusting the marker size of my slider in the Begin Routine tab of a code component. However, it doesn’t make sense that the slider wouldn’t have been defined.
Is the code component above or below the slider?
Is the code in Begin Experiment or Begin Routine?
Please could you show a screenshot of the code and the slider component (if that’s the thing you’re changing in size)?
I am changing the marker size. It’s the only time I’m calling the size method throughout the experiment and the TypeError on Pavlovia occurs immediately before this routine.
Code component is at the top.
The code for changing the marker size is at the beginning of the routine, which seemed right given that it was after the sliders should have been initialized.
Again, it works locally on PsychoPy. Does JS do something different with order of operations/initializing?
To me that doesn’t look like it should work. comfort_ldt.marker is undefined
Try comfort_ldt.setMarkerSize([.01,.05])
To me that doesn’t look like it should work.
^^^So validating
I just tried setMarkerSize in PsychoPy and it doesn’t like that. FWIW, the solution for changing the slider size in PsychoPy came from @dvbridges here:
Slider: Making the dot size smaller without changing overall slider size - Builder - PsychoPy
Neither PsychoPy nor Pavlovia liked setMarkerSize. I reverted back to marker.size in PsychoPy and wrote the setMarkerSize in my JS code.
I got this error on Pavlovia:
TypeError: comfort_ldt.setMarkerSize is not a function
I’ve uploaded my PsychoPy experiment, if that’s helpful
story_list.xlsx (7.9 KB) storyX.xlsx (8.4 KB) pilotProcedure.psyexp (89.9 KB) storyY.xlsx (8.4 KB) ldt_trials.xlsx (9.8 KB)
Got it! Cheers to a posting by @jy16 for getting the right JS code for marker size:
@wakecarter You might want to include this translation difference in your crib sheet.
Wildo, thank you.
Have you checked whether .markerSize= works in Python as well? Or .setMarkerSize() working in both? I try to keep manual translations to a minimum in favour of alternative Python approaches that translate correctly.
Have you checked whether .markerSize= works in Python as well? Or .setMarkerSize() working in both? I try to keep manual translations to a minimum in favour of alternative Python approaches that translate correctly.
I just tried .markerSize and .setMarkerSize and neither doesn’t work in Python. .setMarkerSize() throws an error. .markerSize doesn’t throw an error, but the marker size is just whatever the slider default is.
1 Like