Closed DubbaThony closed 1 year ago
Hey @DubbaThony,
This looks like the Python script is trying to run with Bash for some reason. Check that the first line of the script is #!/usr/bin/env python3.10
and that running /usr/bin/env python3.10
from the command line drops you into an interactive Python 3.10 shell. If it doesn't, you'll need to install Python 3.10 or, if it's already installed, get its location (which python3.10
or whatever the executable is called) and put that in the shebang (e.g. #!/usr/bin/python3.10
, or wherever you found it with which
).
Thanks for reply. Yes, indeed I remved the shebang line as I run with python ./script.py
. I use asdf to get precisely python the script needs:
root@dubba /opt/discord-music # python --version
Python 3.10.10
I've re-added it (and the shebang is correct for my system) Now bot no longer displays these lines but still crashes and re-starts (which is now improvement) in these conditions
Yeah, when I wrote this I wasn't really planning on doing much with it, so my error "handling" was pretty primitive - that being, "if any error occurs during a command just restart the entire bot" (see the on_command_error
function and the restart
script it calls). This was useful when it was in active development because it would ensure that there was always a "clean slate" and that errors didn't propagate, and it meant the bot almost never totally "died".
However, in the situations you've highlighted these errors should probably be handled better. It's probably out of scope of what I have the time to do, but I'm happy to look at a PR to improve error handling.
Btw, if you want to keep the script "shebang-less" you can probably just change the restart
script to directly call python, i.e. change the ./youtubebot.py
line to python ./youtubebot.py
.
That's very fair enough.
While I never touched python I will try to get some free time to figure out how to do it better.
Sounds good! I'll close this issue now if your original issue is fixed - if/when you want to take a look, just open a PR and I'll be happy to review.
Hi, I opened the PR and it's been stale for over a week. I know GH notifs can be a bear sometimes, so just in case you missed it: PR #8 small bump. @maxcutlyp
From my quick testing, bot will crash:
if provided command it fails to understnad:
When video is unavailable:
But overall works neat, and I like it that it downloads stuff locally, avoiding some bandwidth waste for my specific use case (often same music playing).