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 Minolta recognition error in python 3.9 (maybe other versions of python 3.x are also affected) #4186

Merged

Conversation

guillermoaguilar
Copy link
Contributor

@guillermoaguilar guillermoaguilar commented Jul 29, 2021

There was a type error that prevented the Minolta class to get initialized. Error was:

ERROR Couldn't initialize photometer LS100: can't concat str to bytes

It turns out the error was due to different variable types (bytes or string). The commit fixes the inconsistency.

I'm not sure if this error occurs exclusively in python 3.9. I tried to install psychopy in a conda environment with python 3.6 (as recommended by the documentation) but I failed to install wxpython (which is whole another story).

There was a type error that prevented the Minolta class to get initialized.
@guillermoaguilar guillermoaguilar changed the title BF: fixes Minolta recognition error in python 3.9 (at least, maybe other python 3.x version also affected) BF: fixes Minolta recognition error in python 3.9 (maybe other versions of python 3.x are also affected) Jul 29, 2021
@codecov
Copy link

codecov bot commented Aug 2, 2021

Codecov Report

Merging #4186 (ca92b97) into release (71c8d23) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           release    #4186   +/-   ##
========================================
  Coverage    35.80%   35.80%           
========================================
  Files          288      288           
  Lines        56798    56798           
  Branches      9661     9661           
========================================
  Hits         20337    20337           
  Misses       34480    34480           
  Partials      1981     1981           
Impacted Files Coverage Δ
psychopy/hardware/minolta.py 19.29% <0.00%> (ø)

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 71c8d23...ca92b97. Read the comment docs.

@peircej peircej merged commit d0deaa9 into psychopy:release Aug 10, 2021
@peircej
Copy link
Member

peircej commented Aug 10, 2021

Many thanks for picking this up and fixing it @guillermoaguilar The old wrong-way-round error for encode/decode! 😆

I've followed it up with a further commit in #4212
The idea there is that we delay the use of bytes as long as possible to reduce erroneous comparisons with strings. Convert to bytes just before sending the message and convert back to strings as soon as possible. It was giving rise a a further bug that was probably harmless, where we were adding \r\n to every message by an erroneous comparison

thanks again

@guillermoaguilar
Copy link
Contributor Author

You're welcome!

@guillermoaguilar guillermoaguilar deleted the bugfix-minolta-notrecognized branch August 17, 2021 10:33
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.

2 participants