-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected Error: FileExistsError #106
Comments
I'm not the author, but if you use the |
Hi, you can delete the file if you are sure no ble-serial is running, in the console simply: 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! |
Good idea @MrCocoDev , thanks for the contribution! |
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 run
ble-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.
The text was updated successfully, but these errors were encountered: