0

I have a flask application running with flask-script extension. A function (with 3 arguments) is placed in my cron and ended by:

if name == "main": 
    manager.run() 

Like mentioned in the flask-script doc - link

This function works fine when I call it directly in the console (like mentioned in the flask-script doc)

python myfunction.py functionpython arg1 arg2 arg3

but not in my cron (a necessary comment "# arg2 comment" is added).

*/1 * * * * /var/www/TWEETPOKE/myfunction.py functionpython arg1 arg2 arg3 # arg2 comment

When I run this script on a raspberry pi, I get no error from either cron or python. Any clue?

vivekagr
  • 1,786
  • 15
  • 23
jeromef
  • 1
  • 2
  • 1
    You need to give more details. Any specific error message ? How does your myfunction.py code look like ? – codegeek May 05 '14 at 15:19
  • Is `myfunction.py` executable? Have you included a shebang at the top of it (e.g., `#!/usr/bin/env python`)? You may need to include `python` in your cron task. – dirn May 05 '14 at 16:08
  • i tried all the solutions : - add shebang - include python (with or without path) and myfunction.py is executable (cf.if __name__ == "__main__":) i'm a bit confused... – jeromef May 05 '14 at 16:38
  • By executable I think dirn suggested "Did you do a `chmod +x` on your file?" because `if __name__ == "__main__":` doesn't mean a script is executable. You might consider calling it with python in the crontab if you don't have execution right (nor want to add it). – Benoît Latinier Jan 21 '15 at 22:21

0 Answers0