#๐Ÿ”’ "Error" when i'm creating a .exe file

17 messages ยท Page 1 of 1 (latest)

opaque patrol
#

python 2.7 because of dependence

i have a basic code that list my scanners and its working when i execute on my pc: py ws.py
but when i create a .exe file of this code, doenst give any error apparently, but doesnt list the devices. I'm creating the .exe file with this: py -m PyInstaller --onefile .\ws1.py

-- coding: utf-8 --

import twain

try:
src_manager = twain.SourceManager(0)
devices = src_manager.GetSourceList()
print("Aqui4", devices)
except ValueError:
print(ValueError)

When i execute the code local, it gives me
Qt: Untested Windows version 6.2 detected!
('Aqui4', ['TWAIN2 FreeImage Software Scanner'])

When i execute the code from .exe it gives me (this qt Untested Windows... doenst print)
('Aqui4', [])

west inletBOT
#

@opaque patrol

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

tall cairn
#

Are you sure you want to use twain? It's from 2010

#

!pip opencv-python

west inletBOT
tall cairn
#

And it's actually open source.

#
import cv2

index = 0
arr = []
while True:
    cap = cv2.VideoCapture(index)
    if not cap.read()[0]:
        break
    else:
        arr.append(index)
    cap.release()
    index += 1

print(arr)
opaque patrol
#

Can i scan a document with this?

opaque patrol
tall cairn
#

If you're learning then you shouldn't learn something outdated.

opaque patrol
#

I agree, i was just triyng to run some code that uses this twain

tall cairn
#

Do you need to pyinstaller it?

opaque patrol
#

Probably something like this, because it is a communication between a site and the user machine to scan a document

#

The solution that i found was to create a websocket to install on client side and then communicate with the website

west inletBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.