Repeated trials in OSWeb
Hi OpenSesame and OSWeb folks,
I have run into a strange bug (I think) that I haven't encountered before. I have attached a small experiment. When I run this experiment locally in OpenSesame, everything works as expected. But if I run the experiment in a browser with OSWeb, it repeats some trials, so that when practice_loop is set to "sequential", the last item is displayed 3 times instead of once. Items are also repeated when practice_loop is set to "random", although in this case it is not necessarily the final item. What could possibly be going on?
Best,
Ethan

Comments
Hi @ethanweed ,
That's very strange indeed, thanks for pointing this out. I'm going to look into it!
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
@ethanweed This behavior results from the custom
Array.prototype.random()function in the counter_balance script. I don' fully understand how this results in the behavior that it results in, but it certainly has unintended side effects. You can avoid this by simply using the built-inrandom.pick()function. See also:Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks for the quick response @sebastiaan !
I tried with
but that gets me the error message:
File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/inline_script.py", line 116, in run self.workspace._exec(self.crun) File "/Applications/OpenSesame.app/Contents/Resources/share/opensesame_plugins/inline_javascript/inline_javascript.py", line 59, in _exec exec(compiled, self._context) File "<EvalJS snippet>", line 3, in <module> File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/js2py/base.py", line 1158, in get raise MakeError('ReferenceError', '%s is not defined' % prop) js2py.internals.simplex.JsException: ReferenceError: random is not definedwhen I run in the OpenSesame app. But I guess that is because
`random.picker()`only works when the experiment is run in the browser? I'm guessingjs2pycan't convertrandomback to python, maybe? Anyway, it seems to work in the browser now, and that's what I need!/Ethan
I'm guessing
js2pycan't convertrandomback to python, maybe?Yes, that's correct! See also:
Check out SigmundAI.eu for our OpenSesame AI assistant!