pyvisa / pyvisa-py

A pure python PyVISA backend
https://pyvisa-py.readthedocs.io
MIT License
288 stars 124 forks source link

Revert 84fe24d4. #66

Closed herm closed 6 years ago

herm commented 9 years ago

Revert 84fe24d4. With this code transfering binary data is not possible. Tested on both python 2.7 and python 3.4.

MatthieuDartiailh commented 7 years ago

This does look a real issue and according to the discussion in the commit, the commit can be safely reverted. I will trigger bors next Monday if nobody is against.

MatthieuDartiailh commented 7 years ago

Actually this seems to raise quite a lot of issue see related fixes in #67 #86 #70.

skrchnavy commented 6 years ago

This is revert of change in #59 and is duplicate of #86 . And #70 wouldn't work if encode called explicitly in session. #76 tries to fix it another way.

Function is called from 3 files only:

I propose to accept this and caller shall send proper reader (with encode if necessary). For example in usb.py, this function is called:

 return self._read(lambda: self.interface.read(count),
                          count,

So when not working for usb, it shall be changed to:

 return self._read(lambda: self.interface.read(count).encode('ascii'),
                          count,

Similar code is in serial.py.

MatthieuDartiailh commented 6 years ago

@skrchnavy could you make a new PR:

I would prefer to see every issues being fixed at once and hopefully once and for all.

skrchnavy commented 6 years ago

OK, I will test it with both python 2.7 and 3.6 to assure working common way

MatthieuDartiailh commented 6 years ago

Closed by #119