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

twain.exceptions.SequenceError #45

Open
Zhao-fangxu opened this issue Jul 31, 2024 · 3 comments
Open

twain.exceptions.SequenceError #45

Zhao-fangxu opened this issue Jul 31, 2024 · 3 comments

Comments

@Zhao-fangxu
Copy link

Zhao-fangxu commented Jul 31, 2024

import twain
Twain_name1 = "OLYMPUS DP2-TWAIN"
sm = twain.SourceManager(0)
ss = sm.open_source(product_name=Twain_name1)
ss.request_acquire(True, False)
rv = ss.xfer_image_natively()
if rv:
    (handle, count) = rv
    twain.dib_to_bm_file(handle, 'image.bmp')
    Traceback (most recent call last):
  File "D:\proc\twain_proc\test1.py", line 8, in <module>
    rv = ss.xfer_image_natively()
  File "C:\Users\19046\.conda\envs\twain1\lib\site-packages\twain\__init__.py", line 826, in xfer_image_natively
    handle = self._get_native_image()
  File "C:\Users\19046\.conda\envs\twain1\lib\site-packages\twain\__init__.py", line 718, in _get_native_image
    rv = self._call(
  File "C:\Users\19046\.conda\envs\twain1\lib\site-packages\twain\__init__.py", line 239, in _call
    return self._sm._call(self._id, dg, dat, msg, buf, expected_returns)
  File "C:\Users\19046\.conda\envs\twain1\lib\site-packages\twain\__init__.py", line 1333, in _call
    raise exc
twain.exceptions.SequenceError

After calling the scanner, executing ss.xfer_image_natively() will result in an error. May I ask if there is any solution?

@OsamaM0
Copy link

OsamaM0 commented Dec 14, 2024

Same error here any solutions?

@denisenkom
Copy link
Owner

Please enable debug logging and upload logs here.
To enable debug logs add following code:

import logging
logging.basicConfig(level=logging.DEBUG)

Also try testing your scanner drivers with Twacker: https://github.com/twain/twain-toolkit/releases and reply back whether it works or not.

@OsamaM0
Copy link

OsamaM0 commented Dec 15, 2024

I have identified a solution related to my query and noticed that the code in the md file of the pytwain repository (https://github.com/denisenkom/pytwain) produces an error. However, I found that the code samples provided in the demo directory (accessible [here] work excellently with Twain.

Thank you for your efforts in maintaining such an outstanding library!

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

No branches or pull requests

3 participants