denisenkom / pytwain

TWAIN library using ctypes bindings
Other
46 stars 23 forks source link

Type Error on import twain #42

Open furqanazhar opened 8 months ago

furqanazhar commented 8 months ago

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

denisenkom commented 8 months ago

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

furqanazhar commented 8 months ago

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
denisenkom commented 8 months ago

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