Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BF: Fixes ioHub compatiblity issues with Python 3. #1770

Merged
merged 2 commits into from Mar 15, 2018

Conversation

dvbridges
Copy link
Contributor

The fixes are mainly specific to keyboard devices.

The fixes are specifically for keyboard devices.
@@ -610,7 +611,7 @@ def createTrialHandlerRecordTable(self, trials, cv_order=None):

for cond_name in self._cv_order:
cond_val = trial[cond_name]
if isinstance(cond_val, basestring):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we switch this line then unicode strings passed from Py2 will raise errors. I think you can leave it as basestring but then do thisi import at top: from past.builtins import basestring
see http://python-future.org/compatible_idioms.html

Copy link
Member

@peircej peircej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these are good (like converting file to open) but some are going to break the Python2.7 compatibility.

@@ -50,7 +50,7 @@ def __init__(self, ioe_array):

@property
def key(self):
return self._key
return str(self._key, 'utf-8')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will raise an error on Py2.7 (because can't convert to a bytes string with unicode encoding)
You could do:

from past.builtins import unicode

then

return unicode(self._key, 'utf-8')

@coveralls
Copy link

coveralls commented Mar 14, 2018

Coverage Status

Coverage decreased (-0.2%) to 51.598% when pulling 513a6da on dvbridges:ioHub into 22c3bbb on psychopy:master.

@codecov-io
Copy link

codecov-io commented Mar 14, 2018

Codecov Report

Merging #1770 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1770   +/-   ##
=======================================
  Coverage   47.09%   47.09%           
=======================================
  Files         218      218           
  Lines       33282    33282           
  Branches     5555     5555           
=======================================
  Hits        15675    15675           
  Misses      16052    16052           
  Partials     1555     1555

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 22c3bbb...513a6da. Read the comment docs.

@peircej peircej merged commit 2caa8d2 into psychopy:master Mar 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants