Multi Threading scanning
Created by: astadtla
I have a use case where I need to scan 2 different scanners at the same time. when I attempt to multi thread pyinsane2 I get the following TestScanMultiple.txt
error. attached is the python script that generated this error. Any help would be greatly appreciated.
===== RESTART: /home/pi/Documents/LinearBookScanner/TestScanMultiple.py =====
Device Id: 0Device Id: 1
init in thread: 1init in thread: 2
Devices Recieved in thread: 2 Exiting in thread: 2 Exception in thread Thread-1: Traceback (most recent call last): File "/home/pi/Documents/LinearBookScanner/TestScanMultiple.py", line 12, in Scan devices = pyinsane2.get_devices() File "/usr/local/lib/python3.5/dist-packages/pyinsane2/sane/abstract_proc.py", line 268, in get_devices for x in remote_do('get_devices', local_only) File "/usr/local/lib/python3.5/dist-packages/pyinsane2/sane/abstract_proc.py", line 69, in remote_do result = os.read(fifo_s2c, length) OSError: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/usr/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "/home/pi/Documents/LinearBookScanner/TestScanMultiple.py", line 16, in Scan pyinsane2.exit() File "/usr/local/lib/python3.5/dist-packages/pyinsane2/sane/abstract_proc.py", line 120, in exit remote_do('exit') File "/usr/local/lib/python3.5/dist-packages/pyinsane2/sane/abstract_proc.py", line 56, in remote_do os.write(fifo_c2s, length) OSError: [Errno 9] Bad file descriptor