[英]Open and read txt file from USB
我正在使用 Linux。我知道我的 USB 名稱是:
Bus 001 Device 005: ID 8564:1000 Transcend Information, Inc. JetFlash
idVendor 和 idProduct 是:
idVendor 0x8564 Transcend Information, Inc.
idProduct 0x1000 JetFlash
問題出在哪兒? 缺少代碼或其他東西?
我閱讀了PyUSB:從 USB 設備讀取 (2)和其他場景,但與我的並不完全相同,所以請幫忙。
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")
來自 linux 命令的 output(usb.core.USBError:[Errno 13] 訪問被拒絕):
output 是
sudo: python:找不到指令
須藤:python:找不到命令
我試過后的 output, sudo python The_one_i_want.py
現在顯示 output
python: 無法打開文件 '/home/joy/fe_dir/The_one_i_want.py': [Errno 2] 沒有那個文件或目錄
但是文件The_one_I_want (new).py
The_one_I_want.py
位於/fe_dir
目錄中
只需使用sudo
運行
sudo python The_one_i_want.py
因為您得到的錯誤表明您無權這樣做。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.