ContextLab / autoFR

Template for a free recall experiment with automatic audio transcription
8 stars 3 forks source link

Error message 'TemplateNotFound' running experiment #8

Closed jackdolgin closed 4 years ago

jackdolgin commented 4 years ago

Hi,

Great package and super useful! I'm going to submit a pull request (I'm sort of new to GitHub but hopefully that's the right thing to do) with a couple updates to the repo to account for new semantics in using Google's API in the custom.py file, but even accounting for that change, I'm running into the following error running the experiment. As soon as I click that the participant has "Yes, they have signed" the consent form, the terminal displays "[psiTurk server:on mode:sdbx #HITs:0]$ creating audio folder... " and the server.log displays the error below. I'm able to run a sample of the experiment—just the appearance of the first two words, followed by instructions to recall all the words I remember (which are only two since I only saw two) and then after the red microphone appears for ~5 seconds the screen goes blank. Neither the terminal nor server.log have any additional messages. Any guidance would be much appreciated!

2020-05-23 18:31:57,113 Accessing /exp: debug772D75 debug30SB34 debugAOHAJU 
2020-05-23 18:31:57,146 given Counter({(0, 0): 5}) chose (0, 0)
2020-05-23 18:31:58,094 GET /sync route with id: debugAOHAJU:debug30SB34
2020-05-23 18:31:58,269 Exception on /function() {                    console.log('trial number', currentTrialNumber)                    console.log('stimulus', currentStimArray[currentTrialNumber])                    return stimHTMLFormatter(currentStimArray[currentTrialNumber])                } [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 2317, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1840, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1743, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1838, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1824, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python2.7/dist-packages/psiturk/experiment.py", line 747, in regularpage
    return render_template(pagename)
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 134, in render_template
    return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 930, in get_or_select_template
    return self.get_template(template_name_or_list, parent, globals)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 883, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 857, in _load_template
    template = self.loader.load(self, name, globals)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/loaders.py", line 115, in load
    source, filename, uptodate = self.get_source(environment, name)
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 58, in get_source
    return self._get_source_fast(environment, template)
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 86, in _get_source_fast
    raise TemplateNotFound(template)
TemplateNotFound: function() {                    console.log('trial number', currentTrialNumber)                    console.log('stimulus', currentStimArray[currentTrialNumber])                    return stimHTMLFormatter(currentStimArray[currentTrialNumber])                }
jeremymanning commented 4 years ago

Hi @jackdolgin, thanks for reaching out, and we're looking forward to your pull request. @paxtonfitzpatrick, @KirstensGitHub, or @andrewheusser might have more insight into your question, but my memory is that the microphone only appears for a few seconds to prompt you to start speaking. During the blank screen it should still be recording. Is that the behavior you're experiencing, or is the recording stopping early too? The other thought I have is that you may have accidentally set the debug flag to true somewhere, since that will shorten the recording time too.

jackdolgin commented 4 years ago

Hi @jeremymanning, thanks for the quick reply! I think I just figured out a mistake I made that affects the blank screen part—I was running the debug link (http://0.0.0.0:22362/ad?etc) rather than localhost:22362. Now the experiment ends on its own and appears to record the data. I'm still receiving the same error message in server.log, though, and the experiment is still only two words long. Are only two words ('saw' and 'chisel') supposed to be remembered, or are there supposed to be more words (perhaps from speech-context.csv or wordpool.csv)? Thanks again!

jeremymanning commented 4 years ago

Re: the list length and number of lists, both of those are adjustable (see config.js). You can adjust the list length, number of lists, recording duration, and other experimental parameters by tweaking the settings in that file.

jeremymanning commented 4 years ago

The wordlist.csv file provides the full word pool (from which presented words are drawn), and the speech-context.csv file contains the "prior" that the speech-to-text engine uses (i.e. when there are ambiguities in the speech, words from the speech context file are preferred over similarly likely words not listed in that file). You can change one or both of those files to suit your experiment's needs. (But the speech-context.csv file should contain all of the words listed in the wordlist.csv file.)

jeremymanning commented 4 years ago

It looks like this issue is now resolved, but please re-open it (or open a new issue) if you're still having trouble! (And thanks again for your pull request!)

jackdolgin commented 4 years ago

Thank you, works perfectly now! Looks like that was a mistake on my end.