Discussion:
[pyusb-users] Issue finding backend when exe created with pyinstaller 3.1.1
Jay Newens
2016-05-09 14:53:59 UTC
Permalink
I have been having issues getting my program to run as an exe using packager
pyinstaller version 3.1.1. There is a version 3.2 but it has other issues so
I cannot use it. My program checks the status of the Zebra KR403 printer and
my program works fine in my Python 2.7.9 environment, PYUsb 1.0.0, on
Windows 7, but when I create the exe it does not work. Pyinstaller 2.1
works ok but my other parts of my program have been updated and I cannot use
it any longer, the list of problems there is too long.



This is how I set up the backend in my code in my python environment:



import usb

import usb.core

import usb.util

import usb.backend.libusb10 as libusb10

import sys

import requests

dev = usb.core.find(idVendor= int(VID), idProduct= int(PID),
backend=libusb10.get_backend())



After creating my exe, when I run it from the command prompt I get the
following:



Traceback (most recent call last):

File "<string>", line 184, in <module>

File "usb\core.py", line 846, in find

ValueError: No backend available

ZebraKR403PaperStatus2.2 returned -1



I understand that this could be an issue with pyinstaller and I will report
the same issue there. Does anyone else have this issue or have a solution?



Thanks in advance:



Jay
Wander Lairson Costa
2016-05-10 14:48:27 UTC
Permalink
One way to investigate what's going on is to set the PYUSB_DEBUG=debug
environment variable.
Post by Jay Newens
I have been having issues getting my program to run as an exe using packager
pyinstaller version 3.1.1. There is a version 3.2 but it has other issues so
I cannot use it. My program checks the status of the Zebra KR403 printer and
my program works fine in my Python 2.7.9 environment, PYUsb 1.0.0, on
Windows 7, but when I create the exe it does not work. Pyinstaller 2.1
works ok but my other parts of my program have been updated and I cannot use
it any longer, the list of problems there is too long.
import usb
import usb.core
import usb.util
import usb.backend.libusb10 as libusb10
import sys
import requests
dev = usb.core.find(idVendor= int(VID), idProduct= int(PID),
backend=libusb10.get_backend())
After creating my exe, when I run it from the command prompt I get the
File "<string>", line 184, in <module>
File "usb\core.py", line 846, in find
ValueError: No backend available
ZebraKR403PaperStatus2.2 returned -1
I understand that this could be an issue with pyinstaller and I will report
the same issue there. Does anyone else have this issue or have a solution?
Jay
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers
of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
pyusb-users mailing list
https://lists.sourceforge.net/lists/listinfo/pyusb-users
--
Best Regards,
Wander Lairson Costa
Jay Newens
2016-05-10 18:06:28 UTC
Permalink
Hi Again,

I have run this code in my python environment and it returns my backend as
expected:

import os
os.environ['PYUSB_DEBUG'] = 'debug'
import usb.core
trig = usb.core.find()
print trig

Response when running code above:
<usb.core.Device object at 0x0000000002E0CF98>

I even went as far as packaging this with pyinstaller version 3.1.1 and when
running the exe I get the same error:


C:\Python27\Scripts\dist\testdebug>testdebug.exe
Traceback (most recent call last):
File "<string>", line 4, in <module>
File "usb\core.py", line 846, in find
ValueError: No backend available
testdebug returned -1


When packaging the code as an exe I do get a warning file with some possibly
relevant entries I will list below:

missing module named usb.core.USBError - imported by usb.core,
usb.backend.libusb10, usb.backend.libusb01, usb.backend.openusb
missing module named 'usb.backend.libusb0' - imported by
C:\Python27\lib\site-packages\PyInstaller\loader\rthooks\pyi_rth_usb.py
missing module named 'usb.backend.libusb1' - imported by
C:\Python27\lib\site-packages\PyInstaller\loader\rthooks\pyi_rth_usb.py


I have tried using --hidden-backend=usb.backend.libusb10 when packaging and
worked with the spec file a bit but none of the help threads online for this
issue have helped me.

Thanks for your assistance.





-----Original Message-----
From: Wander Lairson Costa [mailto:***@gmail.com]
Sent: Tuesday, May 10, 2016 09:48
To: pyusb-users
Subject: Re: [pyusb-users] Issue finding backend when exe created with
pyinstaller 3.1.1

One way to investigate what's going on is to set the PYUSB_DEBUG=debug
environment variable.
Post by Jay Newens
I have been having issues getting my program to run as an exe using
packager pyinstaller version 3.1.1. There is a version 3.2 but it has
other issues so I cannot use it. My program checks the status of the
Zebra KR403 printer and my program works fine in my Python 2.7.9
environment, PYUsb 1.0.0, on Windows 7, but when I create the exe it
does not work. Pyinstaller 2.1 works ok but my other parts of my
program have been updated and I cannot use it any longer, the list of
problems there is too long.
Post by Jay Newens
import usb
import usb.core
import usb.util
import usb.backend.libusb10 as libusb10
import sys
import requests
dev = usb.core.find(idVendor= int(VID), idProduct= int(PID),
backend=libusb10.get_backend())
After creating my exe, when I run it from the command prompt I get the
File "<string>", line 184, in <module>
File "usb\core.py", line 846, in find
ValueError: No backend available
ZebraKR403PaperStatus2.2 returned -1
I understand that this could be an issue with pyinstaller and I will
report the same issue there. Does anyone else have this issue or have a
solution?
Post by Jay Newens
Jay
----------------------------------------------------------------------
-------- Find and fix application performance issues faster with
Applications Manager Applications Manager provides deep performance
insights into multiple tiers of your business applications. It
resolves application problems quickly and reduces your MTTR. Get your
free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
pyusb-users mailing list
https://lists.sourceforge.net/lists/listinfo/pyusb-users
--
Best Regards,
Wander Lairson Costa

----------------------------------------------------------------------------
--
Mobile security can be enabling, not merely restricting. Employees who bring
their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the apps
on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
pyusb-users mailing list
pyusb-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Loading...