Skip to content

Commit

Permalink
Merge branch 'master' of github.com:NYUCCL/psiTurk
Browse files Browse the repository at this point in the history
  • Loading branch information
deargle committed Nov 11, 2020
2 parents 99de428 + 5971580 commit 424ed58
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions psiturk/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import json
from jinja2 import TemplateNotFound
from collections import Counter
import signal


# Setup flask
from flask import Flask, render_template, render_template_string, request, \
Expand Down Expand Up @@ -580,7 +580,7 @@ def load(uid=None):
else:
try:
resp = json.loads(user.datastring)
except (json.JSONDecodeError, TypeError):
except (ValueError, TypeError, json.JSONDecodeError):
resp = {
"condition": user.cond,
"counterbalance": user.counterbalance,
Expand Down
15 changes: 9 additions & 6 deletions psiturk/psiturk_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def amt_services_wrapper(self):
'- `psiturk server off`',
'- `psiturk debug -p`'])
message = '{}{}'.format(e.message, still_can_do)
self.pfeedback(message)
self.perror(message)
except PsiturkException as e:
self.poutput(e)

Expand Down Expand Up @@ -144,6 +144,7 @@ def __init__(self, config, server, mode='sandbox', quiet=False):

Cmd.__init__(self, persistent_history_file=persistent_history_file)
self.quiet = quiet
self.feedback_to_output = True

if not self.amt_services_wrapper and not self.quiet:
sys.exit()
Expand Down Expand Up @@ -921,15 +922,17 @@ def do_debug(self, arg):
base_url = self.config.get_ad_url()
self.pfeedback('generating debug url using `ad_url` config var')
except PsiturkException:
self.pfeedback('`ad_url_*` config vars not set; using Server Parameters host and port vars.')
self.pfeedback('`ad_url_*` config vars not set; using Server '
'Parameters host and port vars.')
host = self.config.get('Server Parameters', 'host')
port = self.config.get('Server Parameters', 'port')
base_url = f"http://{host}:{port}/ad"

launch_url = base_url + "?assignmentId=debug" + \
str(self.random_id_generator()) + "&hitId=debug" + str(self.random_id_generator()) \
+ "&workerId=debug" + str(self.random_id_generator()
+ "&mode=debug")
launch_url = (f'{base_url}?'
f'assignmentId=debug{self.random_id_generator()}'
f'&hitId=debug{self.random_id_generator()}'
f'&workerId=debug{self.random_id_generator()}'
f'&mode=debug')

if arg['--print-only']:
self.poutput(launch_url)
Expand Down

0 comments on commit 424ed58

Please sign in to comment.