Open noduritoto opened 3 months ago
I'm not the author, but if you use the --port
parameter to change the port you can circumvent this error. I am not sure why the virtual port isn't being cleaned up automatically.
Hi, you can delete the file if you are sure no ble-serial is running, in the console simply: rm /tmp/ttyBLE
It gets auto cleaned on a usual shutdown, but maybe the process was hard killed before, then it can't run the cleanup routine.
The tip from @MrCocoDev for using a different path should work as well.
I think if you add:
try:
self.uart = UART(args.port, loop, args.mtu)
except OSError as e:
# This check might be hype specific to MacOS, not sure
if "FileExistsError(17, 'File exists')" in repr(e):
raise ValueError(
f"Port {args.port} already exists. "
f"Please specify a new port or clean "
f"up the old port, if it is safe to do so."
) from e
You could add a lot of clarity around this issue. I happened to figure it out from an unrelated SO and a good guess, but I imagine a lot of users will just give up in frustration.
Either way, thanks for such an awesome library!
Note: for general support questions, please use the discussions tab. This is the template for bugs in ble-serial. Make sure you have completely read the README, searched through the issues and discussions.
Describe the bug I met a error about 'Unexpected Error: FileExistsError' How can I fix it?
Log messages The full output of
ble-serial -v
(with your usual parameters like-d
). If it is related to BLE chracteristics please also runble-scan -d
with you device address.Put the result into code blocks (wrap with triple backticks) to get proper formatting: $ble-serial -d 12345678989
your log could be here
$ble-serial -d 12345678989 14:08:06.889 | ERROR | main.py: Unexpected Error: FileExistsError(17, 'File exists') 14:08:06.889 | WARNING | main.py: Shutdown initiated 14:08:06.890 | INFO | main.py: Shutdown complete.
Setup (please complete the following information):
bluetoothctl -v
, Linux only]python3 -V
]pip3 list
]Additional Context Tricks for reproducing the issue? Results from other things you have already tried? Ideas what might be the cause, etc.