Python Forum
importing downloaded usb module
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
importing downloaded usb module
#1
Hi, I downloaded pywinusb from GitHub, but I can't remember how to import it. I unzipped it to a folder with a file I'm using to test my modifications. how can I import the downloaded module? I have pywinusb installed via pip but, I cant find the files I want to alter.

Also, I'm trying to communicate to a usb device I created, is there another usb module? preferable one that I don't have to install drivers since I'm using HID just because I don't need to create a diver and it's easier for users
Reply
#2
How do you mean you have downloaded and unzipped pywinusb, but also installed it by pip?
import pywinusb should work. Do you get some errors? If yes, post the full traceback in error tags.
Reply
#3
I have pywin usb installed but I want to alter it so I downloaded it and want to make my modifications. I only downloaded it cause I cant find where pip placed the module
Reply
#4
That would be in \Lib\site-packages location of your Python installation, or virtual environment, in case you are using it.
Reply
#5
Quote:That would be in \Lib\site-packages location of your Python installation, or virtual environment, in case you are using it

I tried looking for it there, and searching for pywinusb. the module works I just cant find it

edit: I found it, I think that because I have more than one version of python windows 10 didn't install the version I'm working on in C:python, but in Appdata

Thanks for helping
Reply
#6
It will be in \Lib\site-packages\pywinusb\hid
Virtual environment is now build into 3.6.
# Make enviroment                                                                   
E:\1                                                                 
λ python -m venv usb_env                                             

# Cd in                                                                     
E:\1                                                                 
λ cd usb_env                                                         
       
# Activate                                                              
E:\1\usb_env                                                         
λ E:\1\usb_env\Scripts\Activate                                      

# Now is this folder isolated and pip point to this folder
(usb_env) E:\1\usb_env                                               
λ pip -V                                                             
pip 9.0.1 from e:\1\usb_env\lib\site-packages (python 3.6)           
                                                                     
(usb_env) E:\1\usb_env                                               
λ pip install pywinusb                                               
Collecting pywinusb                                                  
  Downloading https://files.pythonhosted.org/packages/38/b4/ecce4a3a0
    100% |████████████████████████████████| 71kB 895kB/s             
Installing collected packages: pywinusb                              
  Running setup.py install for pywinusb ... done                     
Successfully installed pywinusb-0.4.2 
So now is all in usb_env folder.
Overview of module pdir
[Image: vBBkzr.jpg]
Clone source code to this folder.
(usb_env) E:\1\usb_env
λ git clone https://github.com/rene-aguirre/pywinusb.git
Cloning into 'pywinusb'...
remote: Counting objects: 799, done.
remote: Total 799 (delta 0), reused 0 (delta 0), pack-reused 799Receiving objects:  96% (768/799)
Receiving objects: 100% (799/799), 218.60 KiB | 0 bytes/s, done.
Resolving deltas: 100% (489/489), done.
Checking connectivity... done.
So now is also source code in own pywinusb folder.
I also install ptpython then is easier to find modules/methods when type . it show all available.
(usb_env) E:\1\usb_env
λ ptpython
>>> import pywinusb.hid as hid

>>> hid.__file__
'e:\\1\\usb_env\\lib\\site-packages\\pywinusb\\hid\\__init__.py'
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  importing variables from module 8376459 1 297 Feb-18-2024, 02:24 PM
Last Post: deanhystad
  no module named 'docx' when importing docx MaartenRo 1 941 Dec-31-2023, 11:21 AM
Last Post: deanhystad
  Downloaded file corrupted emont 5 865 Oct-01-2023, 11:32 AM
Last Post: snippsat
  I downloaded a script and I cant run this luoxr18 3 1,227 Apr-16-2023, 09:33 AM
Last Post: Larz60+
  My code displays too much output when importing class from a module lil_e 4 1,185 Oct-22-2022, 12:56 AM
Last Post: Larz60+
  Importing module in jupyter Noteboook ajitnayak1987 0 1,763 Jun-04-2021, 12:26 PM
Last Post: ajitnayak1987
  ERROR: importing desired module mbgamer28 0 1,698 Apr-05-2021, 07:46 PM
Last Post: mbgamer28
  How to create local copies of Python packages so they do not have to be downloaded okhajut 3 2,045 Sep-29-2020, 02:22 PM
Last Post: buran
  importing module - not working jdhamblett 3 3,052 Jun-22-2020, 07:33 PM
Last Post: jdhamblett
  importing same python library in multiple custom module escape_freedom13 6 3,862 May-10-2020, 07:01 PM
Last Post: escape_freedom13

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020