Forums

Can't run my schedule task

Hi,

I try to run a task but it doesn't seem to work. I get:

It always says "2018-05-11 23:22:11 -- Completed task, took 5.00 seconds, return code was 0." but nothing happens. The python file print multiple things so I thought I was going to see something? Is it a memory problem? How can I get more info about the error?

/home/swdating/.virtualenvs/myvirtualenv/bin/activate /home/swdating/swdating_code/scripts/recup.py

Thank you :)

That return code means that your task did run. Do your prints rely on there being some sort of list of things to work on? If so, check that the list has what you think it should have and trace the problem back from there.

Yes but at the beginning of the script, I have a simple:

print("We start !")

but it doesn't show anything inside the logs. Same sentence:

"2018-05-12 16:24:12 -- Completed task, took 5.00 seconds, return code was 0". It's a bit strange that the script duration is always 5 seconds.

Then make sure that the code you're running is the code you think you're running. You could also try simplifying your code down and then slowly adding things back in to identify what might be causing the issue.

Hi,

So I've added a second task with a python script (/home/swdating/.virtualenvs/myvirtualenv/bin/activate /home/swdating/swdating_code/scripts/test.py) that only contains:

print("Python test is OK")

When I check the logs for that python script, I have:

"2018-05-14 09:34:14 -- Completed task, took 7.00 seconds, return code was 0."

And I don't see my print + 7 seconds for a print is strange?

Thanks in advance.

Damn! I just noticed the problem that's obvious in the first post. You are using the virtualenv incorrectly. Make the task command:

/home/swdating/.virtualenvs/myvirtualenv/bin/python /home/swdating/swdating_code/scripts/recup.py

instead of

/home/swdating/.virtualenvs/myvirtualenv/bin/activate /home/swdating/swdating_code/scripts/recup.py

Sorry it took me so long to spot that.

Thank you :)

Hi, I am having a similar issue (return code 0 but script not executing). My task command is: /home/steppingstonestk/.virtualenvs/sstones/bin/python3.6 /home/steppingstonestk/sstones/sstones /manage_cal.py

When I first ran it, I got an error looking for main.py. I created an empty file with that name and it now has a 0 return code, but doesn't execute anything, including simple print statements at the start of the script. This is the output in the task log: 2019-01-08 03:17:06 -- Completed task, took 3.00 seconds, return code was 0.

Any advice?

thank you.

It looks like you put a space into the path to your script -- that is, instead of scheduling

/home/steppingstonestk/.virtualenvs/sstones/bin/python3.6 /home/steppingstonestk/sstones/sstones/manage_cal.py

...you scheduled

/home/steppingstonestk/.virtualenvs/sstones/bin/python3.6 /home/steppingstonestk/sstones/sstones /manage_cal.py

The extra space means that you're telling Python to execute the directory /home/steppingstonestk/sstones/sstones, passing in the filename /manage_cal.py as a parameter. If you remove the space then it will run your script.

what a Muppet.....Thank you

No problem, glad I could help!