|
15 | 15 | ColorMixin) |
16 | 16 | from random import shuffle |
17 | 17 |
|
| 18 | +from psychopy.constants import PY3 |
| 19 | + |
18 | 20 | __author__ = 'Jon Peirce, David Bridges, Anthony Haffey' |
19 | 21 |
|
20 | 22 |
|
@@ -171,8 +173,12 @@ def _checkHeaders(fields): |
171 | 173 | _checkHeaders(item.keys()) |
172 | 174 | # Convert options to list of strings |
173 | 175 | for idx, item in enumerate(items): |
174 | | - if isinstance(item['options'], str): |
175 | | - items[idx]['options'] = item['options'].split(',') |
| 176 | + if PY3: |
| 177 | + if isinstance(item['options'], str): |
| 178 | + items[idx]['options'] = item['options'].split(',') |
| 179 | + else: # Python2 |
| 180 | + if isinstance(item['options'], unicode): |
| 181 | + items[idx]['options'] = item['options'].split(',') |
176 | 182 | # Check types |
177 | 183 | [_checkTypes(item['type']) for item in items] |
178 | 184 | # Check N options > 1 |
@@ -266,7 +272,7 @@ def _setQuestion(self, item): |
266 | 272 | The width of the question bounding box as type float |
267 | 273 | """ |
268 | 274 | if self.autoLog: |
269 | | - psychopy.logging.exp("Question text: {}".format(item['questionText'])) |
| 275 | + psychopy.logging.exp(u"Question text: {}".format(item['questionText'])) |
270 | 276 |
|
271 | 277 | question = psychopy.visual.TextStim(self.win, |
272 | 278 | text=item['questionText'], |
@@ -310,7 +316,7 @@ def _setResponse(self, item, question): |
310 | 316 | if self.autoLog: |
311 | 317 | psychopy.logging.exp("Response type: {}".format(item['type'])) |
312 | 318 | psychopy.logging.exp("Response layout: {}".format(item['layout'])) |
313 | | - psychopy.logging.exp("Response options: {}".format(item['options'])) |
| 319 | + psychopy.logging.exp(u"Response options: {}".format(item['options'])) |
314 | 320 |
|
315 | 321 | # Create position of response object |
316 | 322 | pos = self._getResponsePos(item, question) |
|
0 commit comments