Forums

The scheduler tasks aren't taking into account the python script header

I have the following header into my python script

1
2
#!/home/usernamepath/.virtualenvs/venv/bin/python
# -*- coding: utf-8 -*-

and I'm specting the task will run in the virtual env instead the task is runing by default in /usr/bin/python so the script is failing to run

how are you calling the script in your scheduled task?

if you did

python /path/to/script.py

then that would not be using the virtualenv python. Instead you should make it executable and just call it like this:

/path/to/script.py

They are listed and scheduled by using your web interface at

https://www.pythonanywhere.com/user/username/tasks_tab/

scheduler

Ok i fix it as you said: pythonpath [space] scriptpath&name.py

Glad to hear that you made it work!