I tried running code as root, this is not helped.
I need raw access to usb device, not HID!
Traceback (most recent call last):
File "hiqos.py", line 20, in <module>
alternate_setting = usb.control.get_interface(device,interface_number)
File "/usr/local/lib/python2.7/site-packages/usb/control.py", line 244, in get_interface
data_or_wLength = 1)[0]
File "/usr/local/lib/python2.7/site-packages/usb/core.py", line 1034, in ctrl_transfer
self._ctx.managed_claim_interface(self, interface_number)
File "/usr/local/lib/python2.7/site-packages/usb/core.py", line 102, in wrapper
return f(self, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/usb/core.py", line 167, in managed_claim_interface
self.backend.claim_interface(self.handle, i)
File "/usr/local/lib/python2.7/site-packages/usb/backend/libusb1.py", line 811, in claim_interface
_check(self.lib.libusb_claim_interface(dev_handle.handle, intf))
File "/usr/local/lib/python2.7/site-packages/usb/backend/libusb1.py", line 595, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 13] Access denied (insufficient permissions)
I had the same error. I've also tried
sudo kextload -bundle-id com.apple.driver.AppleUSBFTDI
but my MacBook can't find it, although it was supposed to work for High Sierra. The only real thing I've been able to do is read input from /dev/disk3 after unmounting it by:
sudo diskutil unmountdisk /dev/disk3
and then
sudo cat /dev/disk3 | hexdump
Related
I have this code to read .txt file from s3 and convert this file to .csv using pandas:
file = pd.read_csv(f's3://{bucket_name}/{bucket_key}', sep=':', error_bad_lines=False)
file.to_csv(f's3://{bucket_name}/file_name.csv')
I have provided read write permission to IAM role but still this errors comes for the .to_csv function:
Anonymous access is forbidden for this operation: PermissionError
update: full error in ec2 logs is:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/s3fs/core.py", line 446, in _mkdir
await self.s3.create_bucket(**params)
File "/usr/local/lib/python3.6/dist-packages/aiobotocore/client.py", line 134, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the CreateBucket operation: Anonymous access is forbidden for this operation
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "convert_file_instance.py", line 92, in <module>
main()
File "convert_file_instance.py", line 36, in main
raise e
File "convert_file_instance.py", line 30, in main
file.to_csv(f's3://{bucket_name}/file_name.csv')
File "/usr/local/lib/python3.6/dist-packages/pandas/core/generic.py", line 3165, in to_csv
decimal=decimal,
File "/usr/local/lib/python3.6/dist-packages/pandas/io/formats/csvs.py", line 67, in __init__
path_or_buf, encoding=encoding, compression=compression, mode=mode
File "/usr/local/lib/python3.6/dist-packages/pandas/io/common.py", line 233, in get_filepath_or_buffer
filepath_or_buffer, mode=mode or "rb", **(storage_options or {})
File "/usr/local/lib/python3.6/dist-packages/fsspec/core.py", line 399, in open
**kwargs
File "/usr/local/lib/python3.6/dist-packages/fsspec/core.py", line 254, in open_files
[fs.makedirs(parent, exist_ok=True) for parent in parents]
File "/usr/local/lib/python3.6/dist-packages/fsspec/core.py", line 254, in <listcomp>
[fs.makedirs(parent, exist_ok=True) for parent in parents]
File "/usr/local/lib/python3.6/dist-packages/s3fs/core.py", line 460, in makedirs
self.mkdir(path, create_parents=True)
File "/usr/local/lib/python3.6/dist-packages/fsspec/asyn.py", line 100, in wrapper
return maybe_sync(func, self, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/fsspec/asyn.py", line 80, in maybe_sync
return sync(loop, func, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/fsspec/asyn.py", line 51, in sync
raise exc.with_traceback(tb)
File "/usr/local/lib/python3.6/dist-packages/fsspec/asyn.py", line 35, in f
result[0] = await future
File "/usr/local/lib/python3.6/dist-packages/s3fs/core.py", line 450, in _mkdir
raise translate_boto_error(e) from e
PermissionError: Anonymous access is forbidden for this operation
I don't know why is it trying to create bucket?
and I have provided full access of s3 to lambda role
Can someone please tell me what i'm missing here?
Thank you.
I think this is due to an incompatibility between the pandas, boto3 and s3fs libraries.
Try this setup:
pandas==1.0.3
boto3==1.13.11
s3fs==0.4.2
I also tried with pandas version 1.1.1, it works too (I work with Python 3.7)
I have never used python before and I want to build a project I found on github but I have not solved a problem there for 2 hours. I don't think it's a problem that I've installed all the packages individually. I've applied all the necessary documents that he narrates, but when I run the following command, I get an error How can I solve this error?
https://github.com/tsurumeso/vocal-remover
Run
python inference.py --input C:\Users\Berkay\Desktop\vocal-remover
error output
PS C:\Users\Berkay\Desktop\vocal-remover> python inference.py --input C:\Users\Berkay\Desktop\vocal-remover loading model... done
C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\librosa\core\audio.py:146: UserWarning: PySoundFile failed. Trying audioread instead.
warnings.warn('PySoundFile failed. Trying audioread instead.')
loading wave source... Traceback (most recent call last):
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\librosa\core\audio.py", line 129, in load
with sf.SoundFile(path) as sf_desc:
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\soundfile.py", line 629, in __init__
self._file = self._open(file, mode_int, closefd)
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\soundfile.py", line 1184, in _open
"Error opening {0!r}: ".format(self.name))
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\soundfile.py", line 1357, in _error_check
raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening 'C:\\Users\\Berkay\\Desktop\\vocal-remover': System error.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "inference.py", line 39, in <module>
args.input, args.sr, False, dtype=np.float32, res_type='kaiser_fast')
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\librosa\core\audio.py", line 147, in load
y, sr_native = __audioread_load(path, offset, duration, dtype)
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\librosa\core\audio.py", line 171, in __audioread_load
with audioread.audio_open(path) as input_file:
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\audioread\__init__.py", line 111, in audio_open
return BackendClass(path)
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\audioread\rawread.py", line 62, in __init__
self._fh = open(filename, 'rb')
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Berkay\\Desktop\\vocal-remover'
I found the solution to the problem.
False
python inference.py --input C:\Users\Berkay\Desktop\vocal-remover
That's right
python inference.py --input C:\Users\Berkay\Desktop\vocal-remover\music.mp3
I think the problem is that your input is a directory, while I bet it should be some audio file. You should do:
inference.py --input path/to/your/audio.wav
I am trying to create a GUI for working with the pip command with a text editor. Currently I am receiving an [Error 18]: Invalid cross-device link which traces back to os.rename which my program does not explicitly call.
I believe that this error occurs because pip is trying to call on a temporary file located on the /tmp/ file system and the actual folders are on the /usr/ file system (same computer different mount points). I have tried to resolve this by creating a new temporary directory in my current working directory via tempfile.TemporaryDirectory(dir='./') and feeding that into my Popen(..., cwd=NewTempDir). I have also tried setting the os.environ['TMPDIR'] = NewTempDir and both of these still lead to the Error 18.
self.tmp = tempfile.TemporaryDirectory(dir='./')
os.environ['TMPDIR'] = self.tmp
....
self.sp = subprocess.Popen([sys.executable, '-m', 'pip', \
pip_dict['process'], pip_dict['package']], \
stdout=subprocess.PIPE, stdin=subprocess.PIPE, \
cwd=self.tmp.name)
....
while True:
stdout = self.sp.stdout.read(1)
self.stdout += stdout
print(self.stdout)
if b'Proceed (y/n)?' in self.stdout:
try:
print('attempting response')
self.sp.stdin.write(b'y\n')
self.sp.stdin.flush()
break
except:
print('stdin write failed')
I expect the output to be the uninstalling of the named package.
My current output is:
Exception:
Traceback (most recent call last):
File "/usr/lib/python3.7/shutil.py", line 563, in move
os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link:
'/usr/lib/python3.7/site-packages/anytree' -> '/tmp/pip-
uninstall-ye0w908_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.7/site-\
packages/pip/_internal/cli/base_command.py", line 179, in
main
status = self.run(options, args)
File "/usr/lib/python3.7/site-
packages/pip/_internal/commands/uninstall.py", line 75, in run
auto_confirm=options.yes, verbose=self.verbosity > 0,
File "/usr/lib/python3.7/site-
packages/pip/_internal/req/req_install.py", line 817, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/usr/lib/python3.7/site-
packages/pip/_internal/req/req_uninstall.py", line 360, in remove
moved.stash(path)
File "/usr/lib/python3.7/site-
packages/pip/_internal/req/req_uninstall.py", line 257, in stash
renames(path, new_path)
File "/usr/lib/python3.7/site-packages/pip/_internal/utils/misc.py",
line 303, in renames
shutil.move(old, new)
File "/usr/lib/python3.7/shutil.py", line 575, in move
rmtree(src)
File "/usr/lib/python3.7/shutil.py", line 491, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib/python3.7/shutil.py", line 449, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib/python3.7/shutil.py", line 447, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'search.py'
I do receive print("attempting response") before the code breaks.
Here is the link to the full program file... https://github.com/rscales02/porcupine/blob/pipgui/porcupine/plugins/pip_plugin.py
Thanks in advance!
So I have been following these documentations so that I can print on my thermal printer through python.
I am running Ubuntu and have the pyusb module installed.
The printer is a Rongta RP58, and it's idVendor and idProduct were found through the lsusb command (0fe6:811e).
Just like in the instructions, I enter:
from escpos.printer import Usb
p = Usb(0x0fe6, 0x811e)
but the error appears
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/testerdell/.local/lib/python2.7/site-packages/escpos/printer.py", line 51, in __init__
self.open()
File "/home/testerdell/.local/lib/python2.7/site-packages/escpos/printer.py", line 62, in open
check_driver = self.device.is_kernel_driver_active(0)
File "/home/testerdell/.local/lib/python2.7/site-packages/usb/core.py", line 1061, in is_kernel_driver_active
self._ctx.managed_open()
File "/home/testerdell/.local/lib/python2.7/site-packages/usb/core.py", line 102, in wrapper
return f(self, *args, **kwargs)
File "/home/testerdell/.local/lib/python2.7/site-packages/usb/core.py", line 120, in managed_open
self.handle = self.backend.open_device(self.dev)
File "/home/testerdell/.local/lib/python2.7/site-packages/usb/backend/libusb1.py", line 786, in open_device
return _DeviceHandle(dev)
File "/home/testerdell/.local/lib/python2.7/site-packages/usb/backend/libusb1.py", line 643, in __init__
_check(_lib.libusb_open(self.devid, byref(self.handle)))
File "/home/testerdell/.local/lib/python2.7/site-packages/usb/backend/libusb1.py", line 595, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 13] Access denied (insufficient permissions)
In the documentation it suggested to create a rule that grants access, but it hasn't worked for me.
sudo nano /etc/udev/rules.d/99-escpos.rules
is the command I use to edit the file, and this is what's inside
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fe6", ATTRS{idProduct}=="811e", MODE="0664", GROUP="dialout"
after changing anything in that file, I run this code:
sudo service udev restart
I am not sure how else I can give USB access to python.
When using direct root access with
sudo su root
the system says "ImportError: No module named escpos.printer". I wouldn't want to enter the password for root access every single time.
Is there a problem with my udev rules, groups, mode, user permissions?
Any help is greatly appreciated! Thanks in advance :)
Change the mode from 664 to 666 in your udev rule and it will work.
I am using pycharm on Python 2.7. I have installed PyNomo. I am trying to run this small example from the official site. Code is available on the link, I have simply copy pasted it. I get the following error:
Aligning with tag A
Traceback (most recent call last):
File "/home/darshil/Desktop/Caltech Summer Internship/Radiation Ononcology Data/DB/rad3/pynomo_temp.py", line 71, in <module>
Nomographer(main_params)
File "/usr/local/lib/python2.7/dist-packages/pynomo/nomographer.py", line 203, in __init__
wrapper.draw_nomogram(c,params['post_func'])
File "/usr/local/lib/python2.7/dist-packages/pynomo/nomo_wrapper.py", line 213, in draw_nomogram
block.draw(canvas)
File "/usr/local/lib/python2.7/dist-packages/pynomo/nomo_wrapper.py", line 445, in draw
atom.draw(canvas)
File "/usr/local/lib/python2.7/dist-packages/pynomo/nomo_wrapper.py", line 2503, in draw
axis_appear=p,base_start=base_start,base_stop=base_stop)
File "/usr/local/lib/python2.7/dist-packages/pynomo/nomo_axis.py", line 123, in __init__
self.draw_axis(canvas)
File "/usr/local/lib/python2.7/dist-packages/pynomo/nomo_axis.py", line 1067, in draw_axis
c.text(x,y,ttext,attr+[text_color])
File "/usr/local/lib/python2.7/dist-packages/pyx/canvas.py", line 324, in text
return self.insert(self.texrunner.text(x, y, atext, *args, **kwargs))
File "/usr/local/lib/python2.7/dist-packages/pyx/text.py", line 1194, in text
self.execute(expr, self.defaulttexmessagesdefaultrun + self.texmessagesdefaultrun + texmessages)
File "/usr/local/lib/python2.7/dist-packages/pyx/text.py", line 951, in execute
self.defaulttexmessagesstart + self.texmessagesstart)
File "/usr/local/lib/python2.7/dist-packages/pyx/text.py", line 1005, in execute
self.texinput.write(self.expr)
IOError: [Errno 32] Broken pipe
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/local/lib/python2.7/dist-packages/pyx/text.py", line 748, in _cleantmp
texrunner.texinput.write("\n\\end\n")
IOError: [Errno 32] Broken pipe
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/local/lib/python2.7/dist-packages/pyx/text.py", line 748, in _cleantmp
texrunner.texinput.write("\n\\end\n")
IOError: [Errno 32] Broken pipe
Process finished with exit code 1
The error is in the final line of the code:
Nomographer(main_params)
I have looked at other questions with "broken pipe error": here,here, and here. But none of them are helpful to me.
Any indication on how to solve would be very helpful.
PyNomo uses a TeX installation to typeset text. Maybe this is missing resulting in a broken pipe. You need to be able to run a file hello.tex with the content Hello, world!\bye on a command line tex hello.tex. It should result in a file hello.dvi. If not you need to install a TeX distribution like TeXLive.