denisenkom / pytwain

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

get_capability demos needed #22

Closed zzxjl1 closed 5 years ago

zzxjl1 commented 5 years ago

get_capability keeps giving out errors

zzxjl1 commented 5 years ago

code:

import twain

def getScanners():
        """Get available scanner from twain module
        """
        sourceManager = twain.SourceManager(0)
        scanners = sourceManager.GetSourceList()
        if scanners:
              scanner = sourceManager.open_source(scanners[0].encode(encoding="utf-8"))
              val = scanner.get_capability(twain.ICAP_YRESOLUTION)
              print(val)
        else:
            return None
print(getScanners())

ERROR:


Traceback (most recent call last):
  File "C:\Users\zzxjl\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\pyScanLib\twainLib.py", line 17, in <module>
    print(getScanners())
  File "C:\Users\zzxjl\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\pyScanLib\twainLib.py", line 11, in getScanners
    val = scanner.get_capability(twain.ICAP_YRESOLUTION)
AttributeError: '_Source' object has no attribute 'get_capability'