NYUCCL / psiTurk

An open platform for science on Amazon Mechanical Turk.
https://psiturk.org
MIT License
277 stars 140 forks source link

can't Quick Start based on README docs #6

Closed RwwL closed 11 years ago

RwwL commented 12 years ago

I've followed the directions in the README—dependencies seem to have installed without issue, and it was easy to find my Access Key ID & Secret Access Key after creating an AWS account—but when I try to run python mturk/createHIT.py I get the an XML response that includes the error "The identity contained in the request is not authorized to use this AWSAccessKeyId."

I'm not sure if the createHIT.py script needs to be successful in order to then run the app, but if I try to run app.py I get: Traceback (most recent call last): File "app.py", line 127, in @app.teardown_request AttributeError: 'Flask' object has no attribute 'teardown_request'

No prior experience w/ Flask or AWS, so this is almost assuredly something glaringly obvious that I'm missing, right?

johnmcdonnell commented 12 years ago

Hi, createHIT.py creates a HIT on Amazon but isn't necessary for running the script. But I think you may need to activate your user as an mturk sandbox requester. Try going to requestersandbox.mturk.com and signing in, I think that may fix the problem there.

I've never seen that second error but a quick perusal of the internets suggests that this may result from having an old version of Flask (which would make sense for the problem of a missing method): http://rajaseelan.com/2011/06/18/attributeerror-flask-object-has-no-attribute-teardown_request/

Can you try the solution there (easy_install Flask==dev) and tell me if that helps?

RwwL commented 12 years ago

Oh, I had signed up vias https://requester.mturk.com/ (per the readme)... After signing up as again at requestersandbox.mturk.com, I'm still getting the same error message, though. I've checked the access key ID and secret access key in the config.txt file against http://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key multiple times — is there a separate version of the security credentials for the sandbox as well, maybe?

Also tried easy_install Flask==dev and it wound up installing Flask 0.10-dev-20121010 plus a couple of dependencies. After that python app.py appears to start the server but when I hit localhost:5001 the browser gets a 404 back and this is in the console:

Traceback (most recent call last): File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/app.py", line 1757, in call return self.wsgi_app(environ, start_response) File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/app.py", line 1745, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/app.py", line 1743, in wsgi_app response = self.full_dispatch_request() File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/app.py", line 1416, in full_dispatch_request rv = self.handle_user_exception(e) File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/app.py", line 1414, in full_dispatch_request rv = self.dispatch_request() File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/app.py", line 1400, in dispatch_request return self.view_functionsrule.endpoint File "/Users/rob/Sites/psiTurk/app.py", line 505, in regularpage return render_template(pagename) File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/templating.py", line 125, in render_template return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list), File "/Library/Python/2.7/site-packages/jinja2/environment.py", line 755, in get_or_select_template return self.get_template(template_name_or_list, parent, globals) File "/Library/Python/2.7/site-packages/jinja2/environment.py", line 716, in get_template return self._load_template(name, self.make_globals(globals)) File "/Library/Python/2.7/site-packages/jinja2/environment.py", line 690, in _load_template template = self.loader.load(self, name, globals) File "/Library/Python/2.7/site-packages/jinja2/loaders.py", line 115, in load source, filename, uptodate = self.get_source(environment, name) File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/templating.py", line 62, in get_source raise TemplateNotFound(template) TemplateNotFound: favicon.ico

That almost looks like the simple lack of a favicon.ico is crashing the app. So I grabbed one from another local web app and stuck it in the templates folder. Now an attempt to hit localhost:5001 yields this:

Traceback (most recent call last): File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/app.py", line 1757, in call return self.wsgi_app(environ, start_response) File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/app.py", line 1745, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/app.py", line 1743, in wsgi_app response = self.full_dispatch_request() File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/app.py", line 1416, in full_dispatch_request rv = self.handle_user_exception(e) File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/app.py", line 1414, in full_dispatch_request rv = self.dispatch_request() File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/app.py", line 1400, in dispatch_request return self.view_functionsrule.endpoint File "/Users/rob/Sites/psiTurk/app.py", line 505, in regularpage return render_template(pagename) File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/templating.py", line 125, in render_template return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list), File "/Library/Python/2.7/site-packages/jinja2/environment.py", line 755, in get_or_select_template return self.get_template(template_name_or_list, parent, globals) File "/Library/Python/2.7/site-packages/jinja2/environment.py", line 716, in get_template return self._load_template(name, self.make_globals(globals)) File "/Library/Python/2.7/site-packages/jinja2/environment.py", line 690, in _load_template template = self.loader.load(self, name, globals) File "/Library/Python/2.7/site-packages/jinja2/loaders.py", line 115, in load source, filename, uptodate = self.get_source(environment, name) File "/Library/Python/2.7/site-packages/Flask-0.10_dev_20121010-py2.7.egg/flask/templating.py", line 58, in get_source return loader.get_source(environment, local_name) File "/Library/Python/2.7/site-packages/jinja2/loaders.py", line 169, in get_source contents = f.read().decode(self.encoding) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0x9e in position 63: invalid start byte

johnmcdonnell commented 12 years ago

Him, no the AWS credentials are universal. Have you used any formatting? E.g., there should be no quotation marks around it.

Wrt.the second issue, could you confirm that the following link does not work? http://localhost:5001/mturk?assignmentId=debug&hitId=debug&workerId=debug

RwwL commented 12 years ago

Aha, disregard, just expected something to be configured to appear at the root of localhost:5001 — I went to mturkindex.html and it looks like I can work with the app now.

RwwL commented 12 years ago

Ah, and just saw your comment — yeah, http://localhost:5001/mturk?assignmentId=debug&hitId=debug&workerId=debug works as expected too.

I guess I'll see if I can get any support form Amazon on the first problem, but it's probably not that relevant to me anyway now that I can run locally and customize templates—I think I'll probably just be helping someone devise their actual experiment and not dealing with the mturk side of things.

Thank you!

johnmcdonnell commented 12 years ago

Sorry just updated my comment because it was in a confusing order due to edits.

Make sure that the formatting in the config file looks like:

aws_access_key_id: somegibberishsdai78ysd789sad79d87adst aws_secret_access_key: somegibberish78asd7a6sdhf87ygasdku77

With no quotes or any formatting like that. You might want to try inserting some print statements into createHIT.py to make sure it's going through correctly, the source code is not very scary!

RwwL commented 12 years ago

Oh, really no, quotes? I set it up without quotes first and got some bizzare error message about an invalid date format, and it showed my access key id crammed inside something else... will check that again later.