Python Forum

Full Version: How to install modules for 2.7 (or sharing from 3.8))
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I have been dabbling in Python on and off for several years and have found a need to motivate me to learn more: (I have fairly extensive experience in VBA/SQL)

I have a X10 hardware home automation interface (CM15) which recently broke down, there are no replacements for it, but an alternative similar to it (CM19) exists, for which the usual driver (Mochad, written in C) does not work well.

I found Python software for the CM19: https://github.com/trrroy/cm19a/blob/mas...aDriver.py which I would like to modify.
The program allows to switch a light (Amongst some other things) on an off from the command line. It is reloaded for every command.
In 2.7, I found that it did what is said it would, notably communicate via USB with the hardware.

My first step was to convert it from Python 2.7 ( to Python 3.8.
In 3.8 it works every 2nd time (systematically.) only

The only differences in the 2.7 and 3.8 code are print and except statements, which do not seem related to my problem.
However, in 2.7 worked with pyUSB 1.0, 3.8 with pyUSB 1.2

To see the functioning of 2.7 with pyUSB 1.2, I uninstalled pyUSB 1.0 after this running the program with 2.7 shows
ImportError: no module named usb
All attempts, to install puUSB (1.2 or 1.0) including installing in a 2.7 virtual environment, show "Requirement already satisfied: pyUSB in /usr.local/lib/python3.8/dist-packages (1.2.1)" but using 2.7 it is not found?

Uninstalling 3.8 to start from scratch created dire warnings, I did not go-ahead. (I am on Linux Mint 20)

Thanks in advance for any help or advise
Pete
you can force pip to install an earlier version of pyusb.
Here are the release versions: https://pypi.org/project/pyusb/#history
use pip install pyusb==1.0.0a2 Change version number to desired version.
Thank you for that: I can now see that pyUSB 1.0.2 gives the same results as pyUSB 1.2 with python 3.8 (program works only every second time it is run) so I have to look elsewhere for this bug.

(After I changed use dict.iteritems() -removed from python 3- to dict.items() the program ran OK every time.)

Pete



(Dec-30-2021, 03:35 AM)Larz60+ Wrote: [ -> ]you can force pip to install an earlier version of pyusb.
Here are the release versions: https://pypi.org/project/pyusb/#history
use pip install pyusb==1.0.0a2 Change version number to desired version.