Skip to content

Commit 3273512

Browse files
authored
Merge pull request #253 from jacob-lee/master
The methods get_trial_data, get_question_data and get_eventdata were not catching TypeError and ValueError exceptions as intended, causing data download in the psiturk shell to fail. The list of exception classes needs to be enclosed in parentheses.
2 parents 388b22c + a391711 commit 3273512

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

psiturk/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __repr__(self):
5757
def get_trial_data(self):
5858
try:
5959
trialdata = json.loads(self.datastring)["data"]
60-
except TypeError, ValueError:
60+
except (TypeError, ValueError):
6161
# There was no data to return.
6262
print("No trial data found in record:", self)
6363
return("")
@@ -81,7 +81,7 @@ def get_trial_data(self):
8181
def get_event_data(self):
8282
try:
8383
eventdata = json.loads(self.datastring)["eventdata"]
84-
except ValueError, TypeError:
84+
except (ValueError, TypeError):
8585
# There was no data to return.
8686
print("No event data found in record:", self)
8787
return("")
@@ -101,7 +101,7 @@ def get_event_data(self):
101101
def get_question_data(self):
102102
try:
103103
questiondata = json.loads(self.datastring)["questiondata"]
104-
except TypeError, ValueError:
104+
except (TypeError, ValueError):
105105
# There was no data to return.
106106
print("No question data found in record:", self)
107107
return("")

0 commit comments

Comments
 (0)