-1

I'm using Linux. I know my USB name is:

Bus 001 Device 005: ID 8564:1000 Transcend Information, Inc. JetFlash

and the idVendor and idProduct is:

idVendor           0x8564 Transcend Information, Inc.   
idProduct          0x1000 JetFlash

Where is the problem? Code or other stuff missing?

I read over the PyUSB: reading from a USB device (2), and other scenario but not really same as mine so give a hand pls.

import usb.core
import usb.util

dev = usb.core.find(idVendor= 0x8564, idProduct=0x1000)

ep = dev[0].interfaces()[0].endpoints()[0]
i=dev[0].interfaces()[0].bInterfaceNumber
dev.reset()

if dev.is_kernel_driver_active(i):
    print("hello")

The output from linux command (usb.core.USBError: [Errno 13] Access denied):

the output from linux command (usb.core.USBError: [Errno 13] Access denied )

  • tried with 'sudo python The_one_i_want.py'

tried with sudo python The_one_i_want.py

the output is

sudo: python:找不到指令
sudo: python: command not found

I just checked my sudo is working:
sudo is working

the output after I tried , sudo python The_one_i_want.pynow the output shows

python: can't open file '/home/joy/fe_dir/The_one_i_want.py': [Errno 2] No such file or directory can't open file

but file The_one_I_want (new).py The_one_I_want.py is inside /fe_dir directory tough

updated tried: now is 'ModuleNotFoundError: No module named 'usb'' , how to solved from here?
ModuleNotFoundError: No module named 'usb'

Dr Mido
  • 2,414
  • 4
  • 32
  • 72
j ton
  • 229
  • 9
  • 1
    try with sudo ... or add your user to an appropriate group (maybe "dialout" or something?) although if your gonna use sudo why not just mount it and read from it as a normal drive? – Joran Beasley Sep 30 '22 at 04:35
  • 2
    Try to run pip install usb as root. because usb may not be installed for root. – TheGoldenTree Sep 30 '22 at 08:21

1 Answers1

1

Simply run with sudo

sudo python The_one_i_want.py

Because the error you got says that you don't have permission to do that.

TheGoldenTree
  • 158
  • 4
  • 16
  • hi, @TheGoldenTree , still not working for that – j ton Sep 30 '22 at 05:42
  • Ok well i found the same question on stackoverflow: https://stackoverflow.com/questions/44726377/sudo-python-command-not-found There are many reasons why you may get this error. so i think the answers in this question may be helpful. – TheGoldenTree Sep 30 '22 at 06:33