Giter VIP home page Giter VIP logo

Comments (4)

jflesch avatar jflesch commented on June 8, 2024

Please call pyinsane2.init() only once from a single thread (for instance in your function Program()). (same goes for pyinsane2.exit()).

from pyinsane.

astadtla avatar astadtla commented on June 8, 2024

TestScanMultiple.txt
I moved all of the references to pyinsane2 outside of the threads but when i get to the section to start the scan in the any one of the threads:
try:
while True:
scan_session.scan.read()
except EOFError:
pass
i get another error:
===== RESTART: /home/pi/Documents/LinearBookScanner/TestScanMultiple.py =====
Device Id: 0Device Id: 1

Exiting in thread: 1Exiting in thread: 2

Exception in thread Thread-1:
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 18, in Scan
scan_session.scan.read()
File "/usr/local/lib/python3.5/dist-packages/pyinsane2/sane/abstract_proc.py", line 173, in read
return remote_do('scan_read', self._scanner_name)
File "/usr/local/lib/python3.5/dist-packages/pyinsane2/sane/abstract_proc.py", line 69, in remote_do
result = os.read(fifo_s2c, length)
MemoryError
Exception in thread Thread-2:
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 18, in Scan
scan_session.scan.read()
File "/usr/local/lib/python3.5/dist-packages/pyinsane2/sane/abstract_proc.py", line 173, in read
return remote_do('scan_read', self._scanner_name)
File "/usr/local/lib/python3.5/dist-packages/pyinsane2/sane/abstract_proc.py", line 70, in remote_do
assert(len(result) == length)
AssertionError

from pyinsane.

jflesch avatar jflesch commented on June 8, 2024

MemoryError

How much free memory does your device has ? It seems it's running out of memory.

Unfortunately, Pyinsane uses quite a lot of memory to store the chunk of the images. In another bug report, someone reported having issues scanning at 600dpi with only 1GB of ram (raspberry pi).

from pyinsane.

astadtla avatar astadtla commented on June 8, 2024

I am using a pi, but I have a swap file that adds a GB so 2 in total. I am only scanning at 150 dpi so it should not be to much of a hog at that level. Was the error replicated on your machine with the script I attached in the previous comment?

from pyinsane.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.