Closed peterdc closed 7 years ago
Unfortunately, I don't have any Apple computer to test and fix this issue. And it works fine on Python2.7 + GNU/Linux.
My guess would be that that dedicated process has crashed while sending the reply. When running from a terminal, did you get any other error / exception ?
I understand the issue of you not having the hardware. I set up a python3 env and using the following script.
These errors and are from the terminal (as was the above). I'm not familiar with python debugging of this nature, any suggestions/links for what to try would be appreciated.
import pyinsane2
pyinsane2.init()
dev = pyinsane2.get_devices()[0]
dev.options.values()
I was able to induce these errors:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/Birch/Envs/sane3/lib/python3.5/site-packages/pyinsane2/sane/abstract_proc.py", line 249, in _get_options
options = remote_do("get_options", self.name)
File "/Users/Birch/Envs/sane3/lib/python3.5/site-packages/pyinsane2/sane/abstract_proc.py", line 69, in remote_do
result = os.read(fifo_s2c, length)
OSError: [Errno 22] Invalid argument
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/Birch/Envs/sane3/lib/python3.5/site-packages/pyinsane2/sane/abstract_proc.py", line 249, in _get_options
options = remote_do("get_options", self.name)
File "/Users/Birch/Envs/sane3/lib/python3.5/site-packages/pyinsane2/sane/abstract_proc.py", line 71, in remote_do
result = pickle.loads(result)
KeyError: 33
Unfortunately, all these errors are telling is that the communication with the dedicated process failed. Usually, on GNU/Linux, those errors are accompanied by other errors from the dedicated process.
Is there any crash indication in your dmesg
?
What you can try is to bypass the dedicated process and call the Sane library directly from your process. Just replace
import pyinsane2
by
import pyinsane2.sane.abstract as pyinsane2
and try again
Unfortunately Mac OS Sierra had changed how loging occurs. I was unable to find anything potentially useful in dmesg or other systems logs I was able find. Open to other suggestions.
The workaround you suggest; however, works for me. I've not had problems with the SANE driver for this scanner in the past, so hopefully that will remain the case.
Well .. it wasn't really intended as a workaround ... I was actually expecting it to crash, but with a more meaningful error message. Because if it works, it means the problem is strictly between the dedicated process and the program. Which means I'm probably making something in the code that is not allowed on MacOSX.
5cdac134136a6c4d28b51665ce78e5c18233b99c
Reading or setting any options for Canon P-215 using Python 2.7.10, MacOS Sierra yields this error:
'canon_dr:libusb:020:011' (CANON, P-215, scanner) Traceback (most recent call last): File "/Users/Birch/Desktop/untitled 5.py", line 12, in
for opt in device.options.values():
File "/Users/Birch/Envs/sane/lib/python2.7/site-packages/pyinsane2/sane/abstract_proc.py", line 249, in _get_options
options = remote_do("get_options", self.name)
File "/Users/Birch/Envs/sane/lib/python2.7/site-packages/pyinsane2/sane/abstract_proc.py", line 70, in remote_do
assert(len(result) == length)
AssertionError