Scheduled Tasks not working

I've tried every command I can find in the forum and in the documentation but haven't had any luck.

I'm trying to run a .py file located in my root folder.

I've tried: python3 python3 /home/my_username/ cd /home/my_username/; python3 (I'm using my actual user folder name in those placeholders above)

I've tried adding #!/usr/bin/python3.9 to the top of the .py file.

I can run the file perfectly fine from my bash console but it won't work in scheduled tasks.

Log is giving this every time: /bin/bash: python: command not found

2021-11-22 03:04:11 -- Completed task, took 5.01 seconds, return code was 127.

Does anyone have any suggestions?

I don't see how any of the commands you used could produce that error. Are you sure those are what you used. It looks like you've removed your task, so we have no way to check what was actually causing the error.

Oops sorry about that.I just recreated the task and tried once more this morning, still the same error.

I adjusted the script for testing purposes, so it should print a success message to bot_log.txt.

I appreciate your help.

Could you run a task with the command

/usr/bin/which python; /usr/bin/which python3; /usr/bin/which python3.9

and let us know what the result was?

Sure thing, looks to be the same results:

/bin/bash: python: command not found

2021-11-22 15:03:26 -- Completed task, took 19.07 seconds, return code was 127.

That's weird. The only thing I can think of now is that one or more of your initialisation files has been changed in a way that breaks the path in scheduled tasks. Have you edited .bashrc, .profile or other .something files in your home directory? You can try deleting .bashrc and .profile from your home directory and then start a new console to re-create them.

You are spot on Glenn. I was changing those files trying to get environment variables to work (later discovered the documentation for them).

Scheduled Tasks are working perfectly now, thank you for your help!

Great! Glad we could get to the bottom of that.