pytwain icon indicating copy to clipboard operation
pytwain copied to clipboard

Type Error on import twain

Open furqanazhar opened this issue 4 months ago • 3 comments

I am facing issue right on the first line.

OS : Windows 10 64-bit

import twain

Traceback (most recent call last): File "C:\Users\DELL\PycharmProjects\DocScanner1\main.py", line 1, in import twain File "C:\Users\DELL\PycharmProjects\DocScanner1\venv\lib\site-packages\twain_init_.py", line 12, in from .lowlevel.structs import * File "C:\Users\DELL\PycharmProjects\DocScanner1\venv\lib\site-packages\twain\lowlevel\structs.py", line 174, in def frame2tuple(frame: TW_FRAME) -> tuple[float, float, float, float]: TypeError: 'type' object is not subscriptable

furqanazhar avatar Feb 16 '24 17:02 furqanazhar

What is your Python version? You are probably using unsupported version, oldest supported version is 3.8

denisenkom avatar Feb 18 '24 18:02 denisenkom

Preivously, I had python 3.8 installed but still same issue so i upgraded to python 3.12 and got it running. But now when i click scan button, below error pops up, can you help me here?

INFO:twain:attempting to load dll: twaindsm.dll
ERROR:twain:load failed with error Could not find module 'twaindsm.dll' (or one of its dependencies). Try using the full path with constructor syntax

furqanazhar avatar Feb 19 '24 05:02 furqanazhar

Here https://pytwain.readthedocs.io/en/latest/ you can find some information on how to install twaindsm.dll

denisenkom avatar Mar 02 '24 19:03 denisenkom