[web2py] Re: has anybody check the the cron in trunk?
Massimo, In trunk your check for Windows should be platform.system() == 'Windows' and not platform.systems() = 'Windows' You've got an extra s in there. I don't know that you need to disable it for windows as a whole or just for the binary distro of web2py. I have to do more testing. Also, I think in your rewrites of cron you may have taken out too much of the logic behind when to run a task, it appears that you are only checking the minute and not the hour, day of week, etc. ~Brian On Jan 30, 9:51 pm, mdipierro mdipie...@cs.depaul.edu wrote: fantastic. I am uploading the fix to trunk. Please make sure I did not mess it up. I very much appreciate your help. On Jan 30, 8:46 pm, Brian M bmere...@gmail.com wrote: Massimo, The problem is in def parsecronline() there needs to be an extra elif clause to deal with that -1 minute value for @reboot tasks. for (s, id) in zip(params[:5], ['min', 'hr', 'dom', 'mon', 'dow']): if not s in [None, '*']: task[id] = [] vals = s.split(',') for val in vals: print val if val.find('/') -1: task[id] += rangetolist(val, id) elif val.isdigit(): task[id].append(int(val)) elif val == -1: #...@reboot line task[id].append(int(-1)) task['user'] = params[5] task['cmd'] = params[6] return task unfortunately, -1 fails the isdigit() test and therefore instead of min containing [-1] it contains nothing []. I'm going to see if I can't figure out the windows space in path issue next. ~Brian On Jan 30, 8:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Hi Brian, can you help me debug this. In gluon/contrib/cron.py there is a line in function crondance: elif not startup and task.get('min',[])==[-1]: continue @reboot startup is supposed to be true the first time only and task.get ('min',[]) is supposed to be ==[-1]. Is this not the case? Can you add a print statement before that line to print statup and task? massimo On Jan 30, 7:52 pm, Brian M bmere...@gmail.com wrote: OK, just pulled latest trunk out of the google code hg repo and @reboot seems to be working on Win7 - actually it's working a bit too good. Not only does it run on web2py startup, but it CONTINUES to run once a minute from then on! I did notice that I had the @reboot crontab syntax wrong earlier. It is supposed to be just @reboot root *mycontroller/myfunction and NOT �...@reboot * * * * root *mycontroller/myfunction as I had tried before. (BTW, the incorrect syntax is shown at the bottom of the docs page -http://web2py.com/examples/default/cron. Though the correct form is towards the top of the same page). If you use that syntax, you get an error message at the console: invalid application name: testing/ * * *default/ on_reboot. ~Brian On Jan 30, 5:39 pm, Brian M bmere...@gmail.com wrote: Well on my Win7 setup with source distribution of web2py I can confirm that @reboot cron lines do not run when I start up web2py. The same cron line with a normal time declaration does run just fine. #...@reboot does not run @reboot * * * * root *reboot/on_reboot #But with normal time syntax runs just fine 0-59/5 * * * * root *reboot/on_reboot As far as spaces in file path names affecting things, I'd need more specific information about what is in people's crontab files. When I was trying to test @reboot I purposely stuck web2py in a path that contained spaces and didn't seem to have any problems. Normally within python scripts I use os.path.join() to build up my file paths so that I don't have to worry about the slashes - os.path.join('C:\', 'Documents and Settings', 'Username', 'My Documents', 'folder', 'sub folder', 'file.txt') works just fine. Also in my crontab, I could execute a non-web2py python script with 0-59/2 * * * * root python C:\Users\Brian\Documents\some project \scripts\some_script.py cron.log On Windows you do need to add the python executable to your path if you don't want to always have to type C:\Python26\python.exe script.py - for some reason the windows python installer doesn't do it automatically. If you don't know already, here's how... Win7: Right click on My Computer and choose Properties On the left side click the Advanced System Settings link. Go to the Advanced tab Click on the Environment Variables button at the bottom. In the System Variables section (the bottom one), scroll down to Path and click once to highlight. (If you want
[web2py] Re: has anybody check the the cron in trunk?
I think I addresses two of the issues. Please take a look. Thanks again for all your help. Massimo On Jan 31, 11:24 am, Brian M bmere...@gmail.com wrote: Massimo, In trunk your check for Windows should be platform.system() == 'Windows' and not platform.systems() = 'Windows' You've got an extra s in there. I don't know that you need to disable it for windows as a whole or just for the binary distro of web2py. I have to do more testing. Also, I think in your rewrites of cron you may have taken out too much of the logic behind when to run a task, it appears that you are only checking the minute and not the hour, day of week, etc. ~Brian On Jan 30, 9:51 pm, mdipierro mdipie...@cs.depaul.edu wrote: fantastic. I am uploading the fix to trunk. Please make sure I did not mess it up. I very much appreciate your help. On Jan 30, 8:46 pm, Brian M bmere...@gmail.com wrote: Massimo, The problem is in def parsecronline() there needs to be an extra elif clause to deal with that -1 minute value for @reboot tasks. for (s, id) in zip(params[:5], ['min', 'hr', 'dom', 'mon', 'dow']): if not s in [None, '*']: task[id] = [] vals = s.split(',') for val in vals: print val if val.find('/') -1: task[id] += rangetolist(val, id) elif val.isdigit(): task[id].append(int(val)) elif val == -1: #...@reboot line task[id].append(int(-1)) task['user'] = params[5] task['cmd'] = params[6] return task unfortunately, -1 fails the isdigit() test and therefore instead of min containing [-1] it contains nothing []. I'm going to see if I can't figure out the windows space in path issue next. ~Brian On Jan 30, 8:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Hi Brian, can you help me debug this. In gluon/contrib/cron.py there is a line in function crondance: elif not startup and task.get('min',[])==[-1]: continue @reboot startup is supposed to be true the first time only and task.get ('min',[]) is supposed to be ==[-1]. Is this not the case? Can you add a print statement before that line to print statup and task? massimo On Jan 30, 7:52 pm, Brian M bmere...@gmail.com wrote: OK, just pulled latest trunk out of the google code hg repo and @reboot seems to be working on Win7 - actually it's working a bit too good. Not only does it run on web2py startup, but it CONTINUES to run once a minute from then on! I did notice that I had the @reboot crontab syntax wrong earlier. It is supposed to be just @reboot root *mycontroller/myfunction and NOT �...@reboot * * * * root *mycontroller/myfunction as I had tried before. (BTW, the incorrect syntax is shown at the bottom of the docs page -http://web2py.com/examples/default/cron. Though the correct form is towards the top of the same page). If you use that syntax, you get an error message at the console: invalid application name: testing/ * * *default/ on_reboot. ~Brian On Jan 30, 5:39 pm, Brian M bmere...@gmail.com wrote: Well on my Win7 setup with source distribution of web2py I can confirm that @reboot cron lines do not run when I start up web2py. The same cron line with a normal time declaration does run just fine. #...@reboot does not run @reboot * * * * root *reboot/on_reboot #But with normal time syntax runs just fine 0-59/5 * * * * root *reboot/on_reboot As far as spaces in file path names affecting things, I'd need more specific information about what is in people's crontab files. When I was trying to test @reboot I purposely stuck web2py in a path that contained spaces and didn't seem to have any problems. Normally within python scripts I use os.path.join() to build up my file paths so that I don't have to worry about the slashes - os.path.join('C:\', 'Documents and Settings', 'Username', 'My Documents', 'folder', 'sub folder', 'file.txt') works just fine. Also in my crontab, I could execute a non-web2py python script with 0-59/2 * * * * root python C:\Users\Brian\Documents\some project \scripts\some_script.py cron.log On Windows you do need to add the python executable to your path if you don't want to always have to type C:\Python26\python.exe script.py - for some reason the windows python installer doesn't do it automatically. If you don't know already, here's how... Win7: Right click on My Computer and choose
[web2py] Re: has anybody check the the cron in trunk?
Yes, that mostly fixes things. However, you still need an explicit test for the @reboot or it won't ever run, check won't have a -1 minute in it. I am testing out a modified cron.py with all of the fixes we've covered in this thread plus the checks for whether or not a task should be run split into its own function for a bit better clarity. I will send you a diff after I've had a chance to test everything on linux. Right now Windows seems to be working pretty well. ~Brian M On Jan 31, 12:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: I think I addresses two of the issues. Please take a look. Thanks again for all your help. Massimo On Jan 31, 11:24 am, Brian M bmere...@gmail.com wrote: Massimo, In trunk your check for Windows should be platform.system() == 'Windows' and not platform.systems() = 'Windows' You've got an extra s in there. I don't know that you need to disable it for windows as a whole or just for the binary distro of web2py. I have to do more testing. Also, I think in your rewrites of cron you may have taken out too much of the logic behind when to run a task, it appears that you are only checking the minute and not the hour, day of week, etc. ~Brian On Jan 30, 9:51 pm, mdipierro mdipie...@cs.depaul.edu wrote: fantastic. I am uploading the fix to trunk. Please make sure I did not mess it up. I very much appreciate your help. On Jan 30, 8:46 pm, Brian M bmere...@gmail.com wrote: Massimo, The problem is in def parsecronline() there needs to be an extra elif clause to deal with that -1 minute value for @reboot tasks. for (s, id) in zip(params[:5], ['min', 'hr', 'dom', 'mon', 'dow']): if not s in [None, '*']: task[id] = [] vals = s.split(',') for val in vals: print val if val.find('/') -1: task[id] += rangetolist(val, id) elif val.isdigit(): task[id].append(int(val)) elif val == -1: #...@reboot line task[id].append(int(-1)) task['user'] = params[5] task['cmd'] = params[6] return task unfortunately, -1 fails the isdigit() test and therefore instead of min containing [-1] it contains nothing []. I'm going to see if I can't figure out the windows space in path issue next. ~Brian On Jan 30, 8:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Hi Brian, can you help me debug this. In gluon/contrib/cron.py there is a line in function crondance: elif not startup and task.get('min',[])==[-1]: continue @reboot startup is supposed to be true the first time only and task.get ('min',[]) is supposed to be ==[-1]. Is this not the case? Can you add a print statement before that line to print statup and task? massimo On Jan 30, 7:52 pm, Brian M bmere...@gmail.com wrote: OK, just pulled latest trunk out of the google code hg repo and @reboot seems to be working on Win7 - actually it's working a bit too good. Not only does it run on web2py startup, but it CONTINUES to run once a minute from then on! I did notice that I had the @reboot crontab syntax wrong earlier. It is supposed to be just @reboot root *mycontroller/myfunction and NOT �...@reboot * * * * root *mycontroller/myfunction as I had tried before. (BTW, the incorrect syntax is shown at the bottom of the docs page -http://web2py.com/examples/default/cron. Though the correct form is towards the top of the same page). If you use that syntax, you get an error message at the console: invalid application name: testing/ * * *default/ on_reboot. ~Brian On Jan 30, 5:39 pm, Brian M bmere...@gmail.com wrote: Well on my Win7 setup with source distribution of web2py I can confirm that @reboot cron lines do not run when I start up web2py. The same cron line with a normal time declaration does run just fine. #...@reboot does not run @reboot * * * * root *reboot/on_reboot #But with normal time syntax runs just fine 0-59/5 * * * * root *reboot/on_reboot As far as spaces in file path names affecting things, I'd need more specific information about what is in people's crontab files. When I was trying to test @reboot I purposely stuck web2py in a path that contained spaces and didn't seem to have any problems. Normally within python scripts I use os.path.join() to build up my file paths so that I don't have to worry about the slashes - os.path.join('C:\',
Re: [web2py] Re: has anybody check the the cron in trunk?
On Jan 31, 2010, at 11:20 AM, Brian M wrote: Yes, that mostly fixes things. However, you still need an explicit test for the @reboot or it won't ever run, check won't have a -1 minute in it. I am testing out a modified cron.py with all of the fixes we've covered in this thread plus the checks for whether or not a task should be run split into its own function for a bit better clarity. I will send you a diff after I've had a chance to test everything on linux. Right now Windows seems to be working pretty well. A cosmetic matter (for now, anyway). cron.py says # crontype can be 'soft', 'hard', 'external', None but widget.py says contrib.cron.crontype = 'External' For now, anyway, it appears that crontype is either 'soft' or not, as far as the logic is concerned. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: has anybody check the the cron in trunk?
The fact is, there are different types of cron but this variable is used only in the case soft. This is a global var and it should go away. The value should go in settings. The logic should depend on the value of this variable. On Jan 31, 1:47 pm, Jonathan Lundell jlund...@pobox.com wrote: On Jan 31, 2010, at 11:20 AM, Brian M wrote: Yes, that mostly fixes things. However, you still need an explicit test for the @reboot or it won't ever run, check won't have a -1 minute in it. I am testing out a modified cron.py with all of the fixes we've covered in this thread plus the checks for whether or not a task should be run split into its own function for a bit better clarity. I will send you a diff after I've had a chance to test everything on linux. Right now Windows seems to be working pretty well. A cosmetic matter (for now, anyway). cron.py says # crontype can be 'soft', 'hard', 'external', None but widget.py says contrib.cron.crontype = 'External' For now, anyway, it appears that crontype is either 'soft' or not, as far as the logic is concerned. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: has anybody check the the cron in trunk?
I'm also workin on refactoring a few things in cron, let's not trip over each other :) I see people have been busy with my code so there are more things to check than I initially thought, but I'm still on track. I also plan on including a test module which will make regression tests easier. On Jan 31, 6:24 pm, Brian M bmere...@gmail.com wrote: Massimo, In trunk your check for Windows should be platform.system() == 'Windows' and not platform.systems() = 'Windows' You've got an extra s in there. I don't know that you need to disable it for windows as a whole or just for the binary distro of web2py. I have to do more testing. Also, I think in your rewrites of cron you may have taken out too much of the logic behind when to run a task, it appears that you are only checking the minute and not the hour, day of week, etc. ~Brian On Jan 30, 9:51 pm, mdipierro mdipie...@cs.depaul.edu wrote: fantastic. I am uploading the fix to trunk. Please make sure I did not mess it up. I very much appreciate your help. On Jan 30, 8:46 pm, Brian M bmere...@gmail.com wrote: Massimo, The problem is in def parsecronline() there needs to be an extra elif clause to deal with that -1 minute value for @reboot tasks. for (s, id) in zip(params[:5], ['min', 'hr', 'dom', 'mon', 'dow']): if not s in [None, '*']: task[id] = [] vals = s.split(',') for val in vals: print val if val.find('/') -1: task[id] += rangetolist(val, id) elif val.isdigit(): task[id].append(int(val)) elif val == -1: #...@reboot line task[id].append(int(-1)) task['user'] = params[5] task['cmd'] = params[6] return task unfortunately, -1 fails the isdigit() test and therefore instead of min containing [-1] it contains nothing []. I'm going to see if I can't figure out the windows space in path issue next. ~Brian On Jan 30, 8:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Hi Brian, can you help me debug this. In gluon/contrib/cron.py there is a line in function crondance: elif not startup and task.get('min',[])==[-1]: continue @reboot startup is supposed to be true the first time only and task.get ('min',[]) is supposed to be ==[-1]. Is this not the case? Can you add a print statement before that line to print statup and task? massimo On Jan 30, 7:52 pm, Brian M bmere...@gmail.com wrote: OK, just pulled latest trunk out of the google code hg repo and @reboot seems to be working on Win7 - actually it's working a bit too good. Not only does it run on web2py startup, but it CONTINUES to run once a minute from then on! I did notice that I had the @reboot crontab syntax wrong earlier. It is supposed to be just @reboot root *mycontroller/myfunction and NOT �...@reboot * * * * root *mycontroller/myfunction as I had tried before. (BTW, the incorrect syntax is shown at the bottom of the docs page -http://web2py.com/examples/default/cron. Though the correct form is towards the top of the same page). If you use that syntax, you get an error message at the console: invalid application name: testing/ * * *default/ on_reboot. ~Brian On Jan 30, 5:39 pm, Brian M bmere...@gmail.com wrote: Well on my Win7 setup with source distribution of web2py I can confirm that @reboot cron lines do not run when I start up web2py. The same cron line with a normal time declaration does run just fine. #...@reboot does not run @reboot * * * * root *reboot/on_reboot #But with normal time syntax runs just fine 0-59/5 * * * * root *reboot/on_reboot As far as spaces in file path names affecting things, I'd need more specific information about what is in people's crontab files. When I was trying to test @reboot I purposely stuck web2py in a path that contained spaces and didn't seem to have any problems. Normally within python scripts I use os.path.join() to build up my file paths so that I don't have to worry about the slashes - os.path.join('C:\', 'Documents and Settings', 'Username', 'My Documents', 'folder', 'sub folder', 'file.txt') works just fine. Also in my crontab, I could execute a non-web2py python script with 0-59/2 * * * * root python C:\Users\Brian\Documents\some project \scripts\some_script.py cron.log On Windows you do need to add the python executable to your path if you don't want to always have to type C:\Python26\python.exe script.py
[web2py] Re: has anybody check the the cron in trunk?
I can stop making changes. Please make sure your changes apply to latest trunk. On Jan 31, 5:19 pm, AchipA attila.cs...@gmail.com wrote: I'm also workin on refactoring a few things in cron, let's not trip over each other :) I see people have been busy with my code so there are more things to check than I initially thought, but I'm still on track. I also plan on including a test module which will make regression tests easier. On Jan 31, 6:24 pm, Brian M bmere...@gmail.com wrote: Massimo, In trunk your check for Windows should be platform.system() == 'Windows' and not platform.systems() = 'Windows' You've got an extra s in there. I don't know that you need to disable it for windows as a whole or just for the binary distro of web2py. I have to do more testing. Also, I think in your rewrites of cron you may have taken out too much of the logic behind when to run a task, it appears that you are only checking the minute and not the hour, day of week, etc. ~Brian On Jan 30, 9:51 pm, mdipierro mdipie...@cs.depaul.edu wrote: fantastic. I am uploading the fix to trunk. Please make sure I did not mess it up. I very much appreciate your help. On Jan 30, 8:46 pm, Brian M bmere...@gmail.com wrote: Massimo, The problem is in def parsecronline() there needs to be an extra elif clause to deal with that -1 minute value for @reboot tasks. for (s, id) in zip(params[:5], ['min', 'hr', 'dom', 'mon', 'dow']): if not s in [None, '*']: task[id] = [] vals = s.split(',') for val in vals: print val if val.find('/') -1: task[id] += rangetolist(val, id) elif val.isdigit(): task[id].append(int(val)) elif val == -1: #...@reboot line task[id].append(int(-1)) task['user'] = params[5] task['cmd'] = params[6] return task unfortunately, -1 fails the isdigit() test and therefore instead of min containing [-1] it contains nothing []. I'm going to see if I can't figure out the windows space in path issue next. ~Brian On Jan 30, 8:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Hi Brian, can you help me debug this. In gluon/contrib/cron.py there is a line in function crondance: elif not startup and task.get('min',[])==[-1]: continue @reboot startup is supposed to be true the first time only and task.get ('min',[]) is supposed to be ==[-1]. Is this not the case? Can you add a print statement before that line to print statup and task? massimo On Jan 30, 7:52 pm, Brian M bmere...@gmail.com wrote: OK, just pulled latest trunk out of the google code hg repo and @reboot seems to be working on Win7 - actually it's working a bit too good. Not only does it run on web2py startup, but it CONTINUES to run once a minute from then on! I did notice that I had the @reboot crontab syntax wrong earlier. It is supposed to be just @reboot root *mycontroller/myfunction and NOT �...@reboot * * * * root *mycontroller/myfunction as I had tried before. (BTW, the incorrect syntax is shown at the bottom of the docs page -http://web2py.com/examples/default/cron. Though the correct form is towards the top of the same page). If you use that syntax, you get an error message at the console: invalid application name: testing/ * * *default/ on_reboot. ~Brian On Jan 30, 5:39 pm, Brian M bmere...@gmail.com wrote: Well on my Win7 setup with source distribution of web2py I can confirm that @reboot cron lines do not run when I start up web2py. The same cron line with a normal time declaration does run just fine. #...@reboot does not run @reboot * * * * root *reboot/on_reboot #But with normal time syntax runs just fine 0-59/5 * * * * root *reboot/on_reboot As far as spaces in file path names affecting things, I'd need more specific information about what is in people's crontab files. When I was trying to test @reboot I purposely stuck web2py in a path that contained spaces and didn't seem to have any problems. Normally within python scripts I use os.path.join() to build up my file paths so that I don't have to worry about the slashes - os.path.join('C:\', 'Documents and Settings', 'Username', 'My Documents', 'folder', 'sub folder', 'file.txt') works just fine. Also in my crontab, I could execute a non-web2py python script with
[web2py] Re: has anybody check the the cron in trunk?
I just tried trunk cron on Linux and it does NOT seem to be working. Oddly, debugging is showing DEBUG:root:WEB2PY CRON Call retruned success: but it does not appear the tasks are actually running. I've got a cron_test app setup with controller functions to write a message to both a file and sqlite database - it works correctly with trunk on Windows and with stable on linux, but it doesn't work with trunk on Linux. controller default contains (partial set, they all follow the same format) - def on_five(): import os.path from datetime import datetime file_path = os.path.join(request.folder,'cron_test.log') print file_path f = open(file_path,'a') message = CRON - 5Min interval web2py application +request.application+ run at +str(datetime.now())+\n f.write(message) db.cron.insert(what=message) db.commit() return dict(message = message) def on_ten(): import os.path from datetime import datetime file_path = os.path.join(request.folder,'cron_test.log') f = open(file_path,'a') message = CRON - 10Min interval web2py application +request.application+ run at +str(datetime.now())+\n f.write(message) db.cron.insert(what=message) db.commit() return dict(message = message) db.py contains: - from datetime import datetime db.define_table('cron', Field('run_datetime','datetime',notnull=True, default=datetime.now ()), Field('run_date','date',notnull=True, default=datetime.now().date ()), Field('run_time','time',notnull=True, default=datetime.now().time ()), Field('what','string',notnull=True)) crontab contains (partial contents) #crontab @reboot root*default/on_reboot 0-59/5 * * * * root *default/on_five cron_runs.log 0-59/10 * * * * root *default/on_ten cron_runs.log Looks like we need to back up a bit. AchipA I'll let you take a shot for a while. Let me know if you'd like help testing. ~Brian M On Jan 31, 8:12 pm, mdipierro mdipie...@cs.depaul.edu wrote: I can stop making changes. Please make sure your changes apply to latest trunk. On Jan 31, 5:19 pm, AchipA attila.cs...@gmail.com wrote: I'm also workin on refactoring a few things in cron, let's not trip over each other :) I see people have been busy with my code so there are more things to check than I initially thought, but I'm still on track. I also plan on including a test module which will make regression tests easier. On Jan 31, 6:24 pm, Brian M bmere...@gmail.com wrote: Massimo, In trunk your check for Windows should be platform.system() == 'Windows' and not platform.systems() = 'Windows' You've got an extra s in there. I don't know that you need to disable it for windows as a whole or just for the binary distro of web2py. I have to do more testing. Also, I think in your rewrites of cron you may have taken out too much of the logic behind when to run a task, it appears that you are only checking the minute and not the hour, day of week, etc. ~Brian On Jan 30, 9:51 pm, mdipierro mdipie...@cs.depaul.edu wrote: fantastic. I am uploading the fix to trunk. Please make sure I did not mess it up. I very much appreciate your help. On Jan 30, 8:46 pm, Brian M bmere...@gmail.com wrote: Massimo, The problem is in def parsecronline() there needs to be an extra elif clause to deal with that -1 minute value for @reboot tasks. for (s, id) in zip(params[:5], ['min', 'hr', 'dom', 'mon', 'dow']): if not s in [None, '*']: task[id] = [] vals = s.split(',') for val in vals: print val if val.find('/') -1: task[id] += rangetolist(val, id) elif val.isdigit(): task[id].append(int(val)) elif val == -1: #...@reboot line task[id].append(int(-1)) task['user'] = params[5] task['cmd'] = params[6] return task unfortunately, -1 fails the isdigit() test and therefore instead of min containing [-1] it contains nothing []. I'm going to see if I can't figure out the windows space in path issue next. ~Brian On Jan 30, 8:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Hi Brian, can you help me debug this. In gluon/contrib/cron.py there is a line in function crondance: elif not startup and task.get('min',[])==[-1]: continue @reboot startup is supposed to be true the first time only and task.get ('min',[]) is supposed to be ==[-1]. Is this not the case? Can you add a print statement before that line to print statup and task? massimo
Re: [web2py] Re: has anybody check the the cron in trunk?
in windows? c:\python25\python.exe its not case sensitive but it is slash sensitive -Thadeus On Sat, Jan 30, 2010 at 12:24 AM, mdipierro mdipie...@cs.depaul.edu wrote: Would this path be right c:/Python25/python.exe or this c:\Python25\python.exe or both? On Jan 29, 11:18 pm, mr.freeze nat...@freezable.com wrote: No but I'm getting this in the console on Windows 7: WARNING:root:WEB2PY CRON Call returned code 1: 'c:/Python25/python.exe\' is not recognized as an internal or external command, operable program or batch file. On Jan 29, 5:37 pm, mdipierro mdipie...@cs.depaul.edu wrote: In particular on windows and the @reboot option? Massimo -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: has anybody check the the cron in trunk?
The problem is when paths contain spaces. I thought even in windows in this case one should esacpe spaces with '\ ' and use either \\ ('' in python) or / ('/') to separate folders. For example: 'C:/windows/Documents\ and\ Settings/' or 'C:\\windows\\Documents\ and\ Settings\\' Am I wrong? Massimo On Jan 30, 11:10 am, Thadeus Burgess thade...@thadeusb.com wrote: in windows? c:\python25\python.exe its not case sensitive but it is slash sensitive -Thadeus On Sat, Jan 30, 2010 at 12:24 AM, mdipierro mdipie...@cs.depaul.edu wrote: Would this path be right c:/Python25/python.exe or this c:\Python25\python.exe or both? On Jan 29, 11:18 pm, mr.freeze nat...@freezable.com wrote: No but I'm getting this in the console on Windows 7: WARNING:root:WEB2PY CRON Call returned code 1: 'c:/Python25/python.exe\' is not recognized as an internal or external command, operable program or batch file. On Jan 29, 5:37 pm, mdipierro mdipie...@cs.depaul.edu wrote: In particular on windows and the @reboot option? Massimo -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: has anybody check the the cron in trunk?
On Jan 30, 2010, at 1:40 PM, mdipierro wrote: The problem is when paths contain spaces. I thought even in windows in this case one should esacpe spaces with '\ ' and use either \\ ('' in python) or / ('/') to separate folders. For example: 'C:/windows/Documents\ and\ Settings/' or 'C:\\windows\\Documents\ and\ Settings\\' Am I wrong? I think so, but I'm no expert on the subject. Consider that if 'c:\\abc' makes Windows see 'c:\abc', then escaping the space isn't going to have any effect. You can quote a command on the command line, so possibly something like: 'C:\\windows\\Documents and Settings\\' might work. Forward slashes are permitted in system calls, but IIRC not on the command line, where (at least back in the DOS days) they denoted command options (equivalent to - in Unix). I'd expect cron entries to be more like command-line or batch-file content. But as I say, I'm no expert. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: has anybody check the the cron in trunk?
I replace the Popen(command) with Popen(list_of_args) and this (according to some) should fix the escaping problem. Needs testing. Massimo On Jan 30, 4:50 pm, Jonathan Lundell jlund...@pobox.com wrote: On Jan 30, 2010, at 1:40 PM, mdipierro wrote: The problem is when paths contain spaces. I thought even in windows in this case one should esacpe spaces with '\ ' and use either \\ ('' in python) or / ('/') to separate folders. For example: 'C:/windows/Documents\ and\ Settings/' or 'C:\\windows\\Documents\ and\ Settings\\' Am I wrong? I think so, but I'm no expert on the subject. Consider that if 'c:\\abc' makes Windows see 'c:\abc', then escaping the space isn't going to have any effect. You can quote a command on the command line, so possibly something like: 'C:\\windows\\Documents and Settings\\' might work. Forward slashes are permitted in system calls, but IIRC not on the command line, where (at least back in the DOS days) they denoted command options (equivalent to - in Unix). I'd expect cron entries to be more like command-line or batch-file content. But as I say, I'm no expert. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: has anybody check the the cron in trunk?
Well on my Win7 setup with source distribution of web2py I can confirm that @reboot cron lines do not run when I start up web2py. The same cron line with a normal time declaration does run just fine. #...@reboot does not run @reboot * * * * root *reboot/on_reboot #But with normal time syntax runs just fine 0-59/5 ** * * root *reboot/on_reboot As far as spaces in file path names affecting things, I'd need more specific information about what is in people's crontab files. When I was trying to test @reboot I purposely stuck web2py in a path that contained spaces and didn't seem to have any problems. Normally within python scripts I use os.path.join() to build up my file paths so that I don't have to worry about the slashes - os.path.join('C:\', 'Documents and Settings', 'Username', 'My Documents', 'folder', 'sub folder', 'file.txt') works just fine. Also in my crontab, I could execute a non-web2py python script with 0-59/2 * * * * root python C:\Users\Brian\Documents\some project \scripts\some_script.py cron.log On Windows you do need to add the python executable to your path if you don't want to always have to type C:\Python26\python.exe script.py - for some reason the windows python installer doesn't do it automatically. If you don't know already, here's how... Win7: Right click on My Computer and choose Properties On the left side click the Advanced System Settings link. Go to the Advanced tab Click on the Environment Variables button at the bottom. In the System Variables section (the bottom one), scroll down to Path and click once to highlight. (If you want it only for your use, add it to the user variables. You'll need to add a new Path variable) Click the Edit... button. In the Variable value field, add ;C:\Python26\ on to the end - without the quotes, the semi-colon is the separator between the multiple entries. (If you're using Python 2.5 then use C:\Python25) Click OK three times to get rid of all the windows. WinXP: Right click on My Computer and choose Properties Go to the Advanced tab. Follow the rest of the instructions above. Same as above ~Brian On Jan 30, 4:55 pm, mdipierro mdipie...@cs.depaul.edu wrote: I replace the Popen(command) with Popen(list_of_args) and this (according to some) should fix the escaping problem. Needs testing. Massimo On Jan 30, 4:50 pm, Jonathan Lundell jlund...@pobox.com wrote: On Jan 30, 2010, at 1:40 PM, mdipierro wrote: The problem is when paths contain spaces. I thought even in windows in this case one should esacpe spaces with '\ ' and use either \\ ('' in python) or / ('/') to separate folders. For example: 'C:/windows/Documents\ and\ Settings/' or 'C:\\windows\\Documents\ and\ Settings\\' Am I wrong? I think so, but I'm no expert on the subject. Consider that if 'c:\\abc' makes Windows see 'c:\abc', then escaping the space isn't going to have any effect. You can quote a command on the command line, so possibly something like: 'C:\\windows\\Documents and Settings\\' might work. Forward slashes are permitted in system calls, but IIRC not on the command line, where (at least back in the DOS days) they denoted command options (equivalent to - in Unix). I'd expect cron entries to be more like command-line or batch-file content. But as I say, I'm no expert. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: has anybody check the the cron in trunk?
which version? Please give me the version timestamp as shown in the main admin interface. On Jan 30, 5:39 pm, Brian M bmere...@gmail.com wrote: Well on my Win7 setup with source distribution of web2py I can confirm that @reboot cron lines do not run when I start up web2py. The same cron line with a normal time declaration does run just fine. #...@reboot does not run @reboot * * * * root *reboot/on_reboot #But with normal time syntax runs just fine 0-59/5 * * * * root *reboot/on_reboot As far as spaces in file path names affecting things, I'd need more specific information about what is in people's crontab files. When I was trying to test @reboot I purposely stuck web2py in a path that contained spaces and didn't seem to have any problems. Normally within python scripts I use os.path.join() to build up my file paths so that I don't have to worry about the slashes - os.path.join('C:\', 'Documents and Settings', 'Username', 'My Documents', 'folder', 'sub folder', 'file.txt') works just fine. Also in my crontab, I could execute a non-web2py python script with 0-59/2 * * * * root python C:\Users\Brian\Documents\some project \scripts\some_script.py cron.log On Windows you do need to add the python executable to your path if you don't want to always have to type C:\Python26\python.exe script.py - for some reason the windows python installer doesn't do it automatically. If you don't know already, here's how... Win7: Right click on My Computer and choose Properties On the left side click the Advanced System Settings link. Go to the Advanced tab Click on the Environment Variables button at the bottom. In the System Variables section (the bottom one), scroll down to Path and click once to highlight. (If you want it only for your use, add it to the user variables. You'll need to add a new Path variable) Click the Edit... button. In the Variable value field, add ;C:\Python26\ on to the end - without the quotes, the semi-colon is the separator between the multiple entries. (If you're using Python 2.5 then use C:\Python25) Click OK three times to get rid of all the windows. WinXP: Right click on My Computer and choose Properties Go to the Advanced tab. Follow the rest of the instructions above. Same as above ~Brian On Jan 30, 4:55 pm, mdipierro mdipie...@cs.depaul.edu wrote: I replace the Popen(command) with Popen(list_of_args) and this (according to some) should fix the escaping problem. Needs testing. Massimo On Jan 30, 4:50 pm, Jonathan Lundell jlund...@pobox.com wrote: On Jan 30, 2010, at 1:40 PM, mdipierro wrote: The problem is when paths contain spaces. I thought even in windows in this case one should esacpe spaces with '\ ' and use either \\ ('' in python) or / ('/') to separate folders. For example: 'C:/windows/Documents\ and\ Settings/' or 'C:\\windows\\Documents\ and\ Settings\\' Am I wrong? I think so, but I'm no expert on the subject. Consider that if 'c:\\abc' makes Windows see 'c:\abc', then escaping the space isn't going to have any effect. You can quote a command on the command line, so possibly something like: 'C:\\windows\\Documents and Settings\\' might work. Forward slashes are permitted in system calls, but IIRC not on the command line, where (at least back in the DOS days) they denoted command options (equivalent to - in Unix). I'd expect cron entries to be more like command-line or batch-file content. But as I say, I'm no expert. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: has anybody check the the cron in trunk?
Can you please try this? http://web2py.com/examples/static/web2py_win_check.zip try with cron, @reboot and with web2py in a path that contains spaces (the main issue). On Jan 30, 5:39 pm, Brian M bmere...@gmail.com wrote: Well on my Win7 setup with source distribution of web2py I can confirm that @reboot cron lines do not run when I start up web2py. The same cron line with a normal time declaration does run just fine. #...@reboot does not run @reboot * * * * root *reboot/on_reboot #But with normal time syntax runs just fine 0-59/5 * * * * root *reboot/on_reboot As far as spaces in file path names affecting things, I'd need more specific information about what is in people's crontab files. When I was trying to test @reboot I purposely stuck web2py in a path that contained spaces and didn't seem to have any problems. Normally within python scripts I use os.path.join() to build up my file paths so that I don't have to worry about the slashes - os.path.join('C:\', 'Documents and Settings', 'Username', 'My Documents', 'folder', 'sub folder', 'file.txt') works just fine. Also in my crontab, I could execute a non-web2py python script with 0-59/2 * * * * root python C:\Users\Brian\Documents\some project \scripts\some_script.py cron.log On Windows you do need to add the python executable to your path if you don't want to always have to type C:\Python26\python.exe script.py - for some reason the windows python installer doesn't do it automatically. If you don't know already, here's how... Win7: Right click on My Computer and choose Properties On the left side click the Advanced System Settings link. Go to the Advanced tab Click on the Environment Variables button at the bottom. In the System Variables section (the bottom one), scroll down to Path and click once to highlight. (If you want it only for your use, add it to the user variables. You'll need to add a new Path variable) Click the Edit... button. In the Variable value field, add ;C:\Python26\ on to the end - without the quotes, the semi-colon is the separator between the multiple entries. (If you're using Python 2.5 then use C:\Python25) Click OK three times to get rid of all the windows. WinXP: Right click on My Computer and choose Properties Go to the Advanced tab. Follow the rest of the instructions above. Same as above ~Brian On Jan 30, 4:55 pm, mdipierro mdipie...@cs.depaul.edu wrote: I replace the Popen(command) with Popen(list_of_args) and this (according to some) should fix the escaping problem. Needs testing. Massimo On Jan 30, 4:50 pm, Jonathan Lundell jlund...@pobox.com wrote: On Jan 30, 2010, at 1:40 PM, mdipierro wrote: The problem is when paths contain spaces. I thought even in windows in this case one should esacpe spaces with '\ ' and use either \\ ('' in python) or / ('/') to separate folders. For example: 'C:/windows/Documents\ and\ Settings/' or 'C:\\windows\\Documents\ and\ Settings\\' Am I wrong? I think so, but I'm no expert on the subject. Consider that if 'c:\\abc' makes Windows see 'c:\abc', then escaping the space isn't going to have any effect. You can quote a command on the command line, so possibly something like: 'C:\\windows\\Documents and Settings\\' might work. Forward slashes are permitted in system calls, but IIRC not on the command line, where (at least back in the DOS days) they denoted command options (equivalent to - in Unix). I'd expect cron entries to be more like command-line or batch-file content. But as I say, I'm no expert. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: has anybody check the the cron in trunk?
OK, just pulled latest trunk out of the google code hg repo and @reboot seems to be working on Win7 - actually it's working a bit too good. Not only does it run on web2py startup, but it CONTINUES to run once a minute from then on! I did notice that I had the @reboot crontab syntax wrong earlier. It is supposed to be just @reboot root*mycontroller/myfunction and NOT @reboot * * * * root *mycontroller/myfunction as I had tried before. (BTW, the incorrect syntax is shown at the bottom of the docs page - http://web2py.com/examples/default/cron. Though the correct form is towards the top of the same page). If you use that syntax, you get an error message at the console: invalid application name: testing/***default/ on_reboot. ~Brian On Jan 30, 5:39 pm, Brian M bmere...@gmail.com wrote: Well on my Win7 setup with source distribution of web2py I can confirm that @reboot cron lines do not run when I start up web2py. The same cron line with a normal time declaration does run just fine. #...@reboot does not run @reboot * * * * root *reboot/on_reboot #But with normal time syntax runs just fine 0-59/5 * * * * root *reboot/on_reboot As far as spaces in file path names affecting things, I'd need more specific information about what is in people's crontab files. When I was trying to test @reboot I purposely stuck web2py in a path that contained spaces and didn't seem to have any problems. Normally within python scripts I use os.path.join() to build up my file paths so that I don't have to worry about the slashes - os.path.join('C:\', 'Documents and Settings', 'Username', 'My Documents', 'folder', 'sub folder', 'file.txt') works just fine. Also in my crontab, I could execute a non-web2py python script with 0-59/2 * * * * root python C:\Users\Brian\Documents\some project \scripts\some_script.py cron.log On Windows you do need to add the python executable to your path if you don't want to always have to type C:\Python26\python.exe script.py - for some reason the windows python installer doesn't do it automatically. If you don't know already, here's how... Win7: Right click on My Computer and choose Properties On the left side click the Advanced System Settings link. Go to the Advanced tab Click on the Environment Variables button at the bottom. In the System Variables section (the bottom one), scroll down to Path and click once to highlight. (If you want it only for your use, add it to the user variables. You'll need to add a new Path variable) Click the Edit... button. In the Variable value field, add ;C:\Python26\ on to the end - without the quotes, the semi-colon is the separator between the multiple entries. (If you're using Python 2.5 then use C:\Python25) Click OK three times to get rid of all the windows. WinXP: Right click on My Computer and choose Properties Go to the Advanced tab. Follow the rest of the instructions above. Same as above ~Brian On Jan 30, 4:55 pm, mdipierro mdipie...@cs.depaul.edu wrote: I replace the Popen(command) with Popen(list_of_args) and this (according to some) should fix the escaping problem. Needs testing. Massimo On Jan 30, 4:50 pm, Jonathan Lundell jlund...@pobox.com wrote: On Jan 30, 2010, at 1:40 PM, mdipierro wrote: The problem is when paths contain spaces. I thought even in windows in this case one should esacpe spaces with '\ ' and use either \\ ('' in python) or / ('/') to separate folders. For example: 'C:/windows/Documents\ and\ Settings/' or 'C:\\windows\\Documents\ and\ Settings\\' Am I wrong? I think so, but I'm no expert on the subject. Consider that if 'c:\\abc' makes Windows see 'c:\abc', then escaping the space isn't going to have any effect. You can quote a command on the command line, so possibly something like: 'C:\\windows\\Documents and Settings\\' might work. Forward slashes are permitted in system calls, but IIRC not on the command line, where (at least back in the DOS days) they denoted command options (equivalent to - in Unix). I'd expect cron entries to be more like command-line or batch-file content. But as I say, I'm no expert. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: has anybody check the the cron in trunk?
Massimo, With your web2py_win_check.zip version, placed in a path containing spaces I get: C:\Users\Brian\Documents\development\web2py\web2py win check \web2pyweb2py.exe web2py Enterprise Web Framework Created by Massimo Di Pierro, Copyright 2007-2010 Version 1.74.8 (2010-01-30 19:00:11) Database drivers available: SQLite3, MySQL Starting cron... WARNING:root:WEB2PY CRON Call returned code 1: The system cannot find the file specified. WARNING:root:WEB2PY CRON Call returned code 1: The system cannot find the file specified. WARNING:root:WEB2PY CRON Call returned code 1: The system cannot find the file specified. WARNING:root:WEB2PY CRON Call returned code 1: The system cannot find the file specified. Yes the WARNING is actually repeated twice. This particular symptom seems to be with the windows binary version of web2py - I can run the source version from a path containing spaces and I do not get this error message. With the source version cron seems to run, well other than the previously mentioned problem with @reboot lines being run on every crondance. I'm trying to pick my way through the cron.py code to see if I can find the issue with @reboot. I suspect the problems with the windows binary are due to the way py2exe works. ~Brian On Jan 30, 7:16 pm, mdipierro mdipie...@cs.depaul.edu wrote: Can you please try this? http://web2py.com/examples/static/web2py_win_check.zip try with cron, @reboot and with web2py in a path that contains spaces (the main issue). On Jan 30, 5:39 pm, Brian M bmere...@gmail.com wrote: Well on my Win7 setup with source distribution of web2py I can confirm that @reboot cron lines do not run when I start up web2py. The same cron line with a normal time declaration does run just fine. #...@reboot does not run @reboot * * * * root *reboot/on_reboot #But with normal time syntax runs just fine 0-59/5 * * * * root *reboot/on_reboot As far as spaces in file path names affecting things, I'd need more specific information about what is in people's crontab files. When I was trying to test @reboot I purposely stuck web2py in a path that contained spaces and didn't seem to have any problems. Normally within python scripts I use os.path.join() to build up my file paths so that I don't have to worry about the slashes - os.path.join('C:\', 'Documents and Settings', 'Username', 'My Documents', 'folder', 'sub folder', 'file.txt') works just fine. Also in my crontab, I could execute a non-web2py python script with 0-59/2 * * * * root python C:\Users\Brian\Documents\some project \scripts\some_script.py cron.log On Windows you do need to add the python executable to your path if you don't want to always have to type C:\Python26\python.exe script.py - for some reason the windows python installer doesn't do it automatically. If you don't know already, here's how... Win7: Right click on My Computer and choose Properties On the left side click the Advanced System Settings link. Go to the Advanced tab Click on the Environment Variables button at the bottom. In the System Variables section (the bottom one), scroll down to Path and click once to highlight. (If you want it only for your use, add it to the user variables. You'll need to add a new Path variable) Click the Edit... button. In the Variable value field, add ;C:\Python26\ on to the end - without the quotes, the semi-colon is the separator between the multiple entries. (If you're using Python 2.5 then use C:\Python25) Click OK three times to get rid of all the windows. WinXP: Right click on My Computer and choose Properties Go to the Advanced tab. Follow the rest of the instructions above. Same as above ~Brian On Jan 30, 4:55 pm, mdipierro mdipie...@cs.depaul.edu wrote: I replace the Popen(command) with Popen(list_of_args) and this (according to some) should fix the escaping problem. Needs testing. Massimo On Jan 30, 4:50 pm, Jonathan Lundell jlund...@pobox.com wrote: On Jan 30, 2010, at 1:40 PM, mdipierro wrote: The problem is when paths contain spaces. I thought even in windows in this case one should esacpe spaces with '\ ' and use either \\ ('' in python) or / ('/') to separate folders. For example: 'C:/windows/Documents\ and\ Settings/' or 'C:\\windows\\Documents\ and\ Settings\\' Am I wrong? I think so, but I'm no expert on the subject. Consider that if 'c:\\abc' makes Windows see 'c:\abc', then escaping the space isn't going to have any effect. You can quote a command on the command line, so possibly something like: 'C:\\windows\\Documents and Settings\\' might work. Forward slashes are permitted in system calls, but IIRC not on the command line, where (at least back in the DOS days) they denoted command options (equivalent to - in Unix). I'd
[web2py] Re: has anybody check the the cron in trunk?
Hi Brian, can you help me debug this. In gluon/contrib/cron.py there is a line in function crondance: elif not startup and task.get('min',[])==[-1]: continue @reboot startup is supposed to be true the first time only and task.get ('min',[]) is supposed to be ==[-1]. Is this not the case? Can you add a print statement before that line to print statup and task? massimo On Jan 30, 7:52 pm, Brian M bmere...@gmail.com wrote: OK, just pulled latest trunk out of the google code hg repo and @reboot seems to be working on Win7 - actually it's working a bit too good. Not only does it run on web2py startup, but it CONTINUES to run once a minute from then on! I did notice that I had the @reboot crontab syntax wrong earlier. It is supposed to be just @reboot root *mycontroller/myfunction and NOT �...@reboot * * * * root *mycontroller/myfunction as I had tried before. (BTW, the incorrect syntax is shown at the bottom of the docs page -http://web2py.com/examples/default/cron. Though the correct form is towards the top of the same page). If you use that syntax, you get an error message at the console: invalid application name: testing/ * * *default/ on_reboot. ~Brian On Jan 30, 5:39 pm, Brian M bmere...@gmail.com wrote: Well on my Win7 setup with source distribution of web2py I can confirm that @reboot cron lines do not run when I start up web2py. The same cron line with a normal time declaration does run just fine. #...@reboot does not run @reboot * * * * root *reboot/on_reboot #But with normal time syntax runs just fine 0-59/5 * * * * root *reboot/on_reboot As far as spaces in file path names affecting things, I'd need more specific information about what is in people's crontab files. When I was trying to test @reboot I purposely stuck web2py in a path that contained spaces and didn't seem to have any problems. Normally within python scripts I use os.path.join() to build up my file paths so that I don't have to worry about the slashes - os.path.join('C:\', 'Documents and Settings', 'Username', 'My Documents', 'folder', 'sub folder', 'file.txt') works just fine. Also in my crontab, I could execute a non-web2py python script with 0-59/2 * * * * root python C:\Users\Brian\Documents\some project \scripts\some_script.py cron.log On Windows you do need to add the python executable to your path if you don't want to always have to type C:\Python26\python.exe script.py - for some reason the windows python installer doesn't do it automatically. If you don't know already, here's how... Win7: Right click on My Computer and choose Properties On the left side click the Advanced System Settings link. Go to the Advanced tab Click on the Environment Variables button at the bottom. In the System Variables section (the bottom one), scroll down to Path and click once to highlight. (If you want it only for your use, add it to the user variables. You'll need to add a new Path variable) Click the Edit... button. In the Variable value field, add ;C:\Python26\ on to the end - without the quotes, the semi-colon is the separator between the multiple entries. (If you're using Python 2.5 then use C:\Python25) Click OK three times to get rid of all the windows. WinXP: Right click on My Computer and choose Properties Go to the Advanced tab. Follow the rest of the instructions above. Same as above ~Brian On Jan 30, 4:55 pm, mdipierro mdipie...@cs.depaul.edu wrote: I replace the Popen(command) with Popen(list_of_args) and this (according to some) should fix the escaping problem. Needs testing. Massimo On Jan 30, 4:50 pm, Jonathan Lundell jlund...@pobox.com wrote: On Jan 30, 2010, at 1:40 PM, mdipierro wrote: The problem is when paths contain spaces. I thought even in windows in this case one should esacpe spaces with '\ ' and use either \\ ('' in python) or / ('/') to separate folders. For example: 'C:/windows/Documents\ and\ Settings/' or 'C:\\windows\\Documents\ and\ Settings\\' Am I wrong? I think so, but I'm no expert on the subject. Consider that if 'c:\\abc' makes Windows see 'c:\abc', then escaping the space isn't going to have any effect. You can quote a command on the command line, so possibly something like: 'C:\\windows\\Documents and Settings\\' might work. Forward slashes are permitted in system calls, but IIRC not on the command line, where (at least back in the DOS days) they denoted command options (equivalent to - in Unix). I'd expect cron entries to be more like command-line or batch-file content. But as I say, I'm no expert. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this
[web2py] Re: has anybody check the the cron in trunk?
Massimo, The problem is in def parsecronline() there needs to be an extra elif clause to deal with that -1 minute value for @reboot tasks. for (s, id) in zip(params[:5], ['min', 'hr', 'dom', 'mon', 'dow']): if not s in [None, '*']: task[id] = [] vals = s.split(',') for val in vals: print val if val.find('/') -1: task[id] += rangetolist(val, id) elif val.isdigit(): task[id].append(int(val)) elif val == -1: #...@reboot line task[id].append(int(-1)) task['user'] = params[5] task['cmd'] = params[6] return task unfortunately, -1 fails the isdigit() test and therefore instead of min containing [-1] it contains nothing []. I'm going to see if I can't figure out the windows space in path issue next. ~Brian On Jan 30, 8:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Hi Brian, can you help me debug this. In gluon/contrib/cron.py there is a line in function crondance: elif not startup and task.get('min',[])==[-1]: continue @reboot startup is supposed to be true the first time only and task.get ('min',[]) is supposed to be ==[-1]. Is this not the case? Can you add a print statement before that line to print statup and task? massimo On Jan 30, 7:52 pm, Brian M bmere...@gmail.com wrote: OK, just pulled latest trunk out of the google code hg repo and @reboot seems to be working on Win7 - actually it's working a bit too good. Not only does it run on web2py startup, but it CONTINUES to run once a minute from then on! I did notice that I had the @reboot crontab syntax wrong earlier. It is supposed to be just @reboot root *mycontroller/myfunction and NOT �...@reboot * * * * root *mycontroller/myfunction as I had tried before. (BTW, the incorrect syntax is shown at the bottom of the docs page -http://web2py.com/examples/default/cron. Though the correct form is towards the top of the same page). If you use that syntax, you get an error message at the console: invalid application name: testing/ * * *default/ on_reboot. ~Brian On Jan 30, 5:39 pm, Brian M bmere...@gmail.com wrote: Well on my Win7 setup with source distribution of web2py I can confirm that @reboot cron lines do not run when I start up web2py. The same cron line with a normal time declaration does run just fine. #...@reboot does not run @reboot * * * * root *reboot/on_reboot #But with normal time syntax runs just fine 0-59/5 * * * * root *reboot/on_reboot As far as spaces in file path names affecting things, I'd need more specific information about what is in people's crontab files. When I was trying to test @reboot I purposely stuck web2py in a path that contained spaces and didn't seem to have any problems. Normally within python scripts I use os.path.join() to build up my file paths so that I don't have to worry about the slashes - os.path.join('C:\', 'Documents and Settings', 'Username', 'My Documents', 'folder', 'sub folder', 'file.txt') works just fine. Also in my crontab, I could execute a non-web2py python script with 0-59/2 * * * * root python C:\Users\Brian\Documents\some project \scripts\some_script.py cron.log On Windows you do need to add the python executable to your path if you don't want to always have to type C:\Python26\python.exe script.py - for some reason the windows python installer doesn't do it automatically. If you don't know already, here's how... Win7: Right click on My Computer and choose Properties On the left side click the Advanced System Settings link. Go to the Advanced tab Click on the Environment Variables button at the bottom. In the System Variables section (the bottom one), scroll down to Path and click once to highlight. (If you want it only for your use, add it to the user variables. You'll need to add a new Path variable) Click the Edit... button. In the Variable value field, add ;C:\Python26\ on to the end - without the quotes, the semi-colon is the separator between the multiple entries. (If you're using Python 2.5 then use C:\Python25) Click OK three times to get rid of all the windows. WinXP: Right click on My Computer and choose Properties Go to the Advanced tab. Follow the rest of the instructions above. Same as above ~Brian On Jan 30, 4:55 pm, mdipierro mdipie...@cs.depaul.edu wrote: I replace the Popen(command) with Popen(list_of_args) and this (according to some) should fix the escaping problem. Needs testing. Massimo On Jan 30, 4:50 pm, Jonathan Lundell jlund...@pobox.com wrote: On Jan 30, 2010, at 1:40 PM, mdipierro wrote: The
[web2py] Re: has anybody check the the cron in trunk?
fantastic. I am uploading the fix to trunk. Please make sure I did not mess it up. I very much appreciate your help. On Jan 30, 8:46 pm, Brian M bmere...@gmail.com wrote: Massimo, The problem is in def parsecronline() there needs to be an extra elif clause to deal with that -1 minute value for @reboot tasks. for (s, id) in zip(params[:5], ['min', 'hr', 'dom', 'mon', 'dow']): if not s in [None, '*']: task[id] = [] vals = s.split(',') for val in vals: print val if val.find('/') -1: task[id] += rangetolist(val, id) elif val.isdigit(): task[id].append(int(val)) elif val == -1: #...@reboot line task[id].append(int(-1)) task['user'] = params[5] task['cmd'] = params[6] return task unfortunately, -1 fails the isdigit() test and therefore instead of min containing [-1] it contains nothing []. I'm going to see if I can't figure out the windows space in path issue next. ~Brian On Jan 30, 8:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Hi Brian, can you help me debug this. In gluon/contrib/cron.py there is a line in function crondance: elif not startup and task.get('min',[])==[-1]: continue @reboot startup is supposed to be true the first time only and task.get ('min',[]) is supposed to be ==[-1]. Is this not the case? Can you add a print statement before that line to print statup and task? massimo On Jan 30, 7:52 pm, Brian M bmere...@gmail.com wrote: OK, just pulled latest trunk out of the google code hg repo and @reboot seems to be working on Win7 - actually it's working a bit too good. Not only does it run on web2py startup, but it CONTINUES to run once a minute from then on! I did notice that I had the @reboot crontab syntax wrong earlier. It is supposed to be just @reboot root *mycontroller/myfunction and NOT �...@reboot * * * * root *mycontroller/myfunction as I had tried before. (BTW, the incorrect syntax is shown at the bottom of the docs page -http://web2py.com/examples/default/cron. Though the correct form is towards the top of the same page). If you use that syntax, you get an error message at the console: invalid application name: testing/ * * *default/ on_reboot. ~Brian On Jan 30, 5:39 pm, Brian M bmere...@gmail.com wrote: Well on my Win7 setup with source distribution of web2py I can confirm that @reboot cron lines do not run when I start up web2py. The same cron line with a normal time declaration does run just fine. #...@reboot does not run @reboot * * * * root *reboot/on_reboot #But with normal time syntax runs just fine 0-59/5 * * * * root *reboot/on_reboot As far as spaces in file path names affecting things, I'd need more specific information about what is in people's crontab files. When I was trying to test @reboot I purposely stuck web2py in a path that contained spaces and didn't seem to have any problems. Normally within python scripts I use os.path.join() to build up my file paths so that I don't have to worry about the slashes - os.path.join('C:\', 'Documents and Settings', 'Username', 'My Documents', 'folder', 'sub folder', 'file.txt') works just fine. Also in my crontab, I could execute a non-web2py python script with 0-59/2 * * * * root python C:\Users\Brian\Documents\some project \scripts\some_script.py cron.log On Windows you do need to add the python executable to your path if you don't want to always have to type C:\Python26\python.exe script.py - for some reason the windows python installer doesn't do it automatically. If you don't know already, here's how... Win7: Right click on My Computer and choose Properties On the left side click the Advanced System Settings link. Go to the Advanced tab Click on the Environment Variables button at the bottom. In the System Variables section (the bottom one), scroll down to Path and click once to highlight. (If you want it only for your use, add it to the user variables. You'll need to add a new Path variable) Click the Edit... button. In the Variable value field, add ;C:\Python26\ on to the end - without the quotes, the semi-colon is the separator between the multiple entries. (If you're using Python 2.5 then use C:\Python25) Click OK three times to get rid of all the windows. WinXP: Right click on My Computer and choose Properties Go to the Advanced tab. Follow the rest of the instructions above. Same as above ~Brian On Jan 30, 4:55 pm, mdipierro mdipie...@cs.depaul.edu wrote: I replace the
[web2py] Re: has anybody check the the cron in trunk?
I think I may have a solution to the windows binary's problem with spaces in file paths. It seems that Windows doesn't like shell=True in Popen(). I'm thinking that checking if we're running web2py.exe or web2py_no_console.exe and if so setting shell=False should do it. I've got what seems to be a working cron.py, but need to do more testing first to make sure it doesn't break anything (and try it on Linux too). Massimo, I haven't tried the trunk version yet, but it looks reasonable. ~Brian On Jan 30, 9:51 pm, mdipierro mdipie...@cs.depaul.edu wrote: fantastic. I am uploading the fix to trunk. Please make sure I did not mess it up. I very much appreciate your help. On Jan 30, 8:46 pm, Brian M bmere...@gmail.com wrote: Massimo, The problem is in def parsecronline() there needs to be an extra elif clause to deal with that -1 minute value for @reboot tasks. for (s, id) in zip(params[:5], ['min', 'hr', 'dom', 'mon', 'dow']): if not s in [None, '*']: task[id] = [] vals = s.split(',') for val in vals: print val if val.find('/') -1: task[id] += rangetolist(val, id) elif val.isdigit(): task[id].append(int(val)) elif val == -1: #...@reboot line task[id].append(int(-1)) task['user'] = params[5] task['cmd'] = params[6] return task unfortunately, -1 fails the isdigit() test and therefore instead of min containing [-1] it contains nothing []. I'm going to see if I can't figure out the windows space in path issue next. ~Brian On Jan 30, 8:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Hi Brian, can you help me debug this. In gluon/contrib/cron.py there is a line in function crondance: elif not startup and task.get('min',[])==[-1]: continue @reboot startup is supposed to be true the first time only and task.get ('min',[]) is supposed to be ==[-1]. Is this not the case? Can you add a print statement before that line to print statup and task? massimo On Jan 30, 7:52 pm, Brian M bmere...@gmail.com wrote: OK, just pulled latest trunk out of the google code hg repo and @reboot seems to be working on Win7 - actually it's working a bit too good. Not only does it run on web2py startup, but it CONTINUES to run once a minute from then on! I did notice that I had the @reboot crontab syntax wrong earlier. It is supposed to be just @reboot root *mycontroller/myfunction and NOT �...@reboot * * * * root *mycontroller/myfunction as I had tried before. (BTW, the incorrect syntax is shown at the bottom of the docs page -http://web2py.com/examples/default/cron. Though the correct form is towards the top of the same page). If you use that syntax, you get an error message at the console: invalid application name: testing/ * * *default/ on_reboot. ~Brian On Jan 30, 5:39 pm, Brian M bmere...@gmail.com wrote: Well on my Win7 setup with source distribution of web2py I can confirm that @reboot cron lines do not run when I start up web2py. The same cron line with a normal time declaration does run just fine. #...@reboot does not run @reboot * * * * root *reboot/on_reboot #But with normal time syntax runs just fine 0-59/5 * * * * root *reboot/on_reboot As far as spaces in file path names affecting things, I'd need more specific information about what is in people's crontab files. When I was trying to test @reboot I purposely stuck web2py in a path that contained spaces and didn't seem to have any problems. Normally within python scripts I use os.path.join() to build up my file paths so that I don't have to worry about the slashes - os.path.join('C:\', 'Documents and Settings', 'Username', 'My Documents', 'folder', 'sub folder', 'file.txt') works just fine. Also in my crontab, I could execute a non-web2py python script with 0-59/2 * * * * root python C:\Users\Brian\Documents\some project \scripts\some_script.py cron.log On Windows you do need to add the python executable to your path if you don't want to always have to type C:\Python26\python.exe script.py - for some reason the windows python installer doesn't do it automatically. If you don't know already, here's how... Win7: Right click on My Computer and choose Properties On the left side click the Advanced System Settings link. Go to the Advanced tab Click on the Environment Variables button at the bottom. In the System Variables section (the bottom one), scroll down to Path and click once to highlight. (If you
[web2py] Re: has anybody check the the cron in trunk?
No but I'm getting this in the console on Windows 7: WARNING:root:WEB2PY CRON Call returned code 1: 'c:/Python25/python.exe\' is not recognized as an internal or external command, operable program or batch file. On Jan 29, 5:37 pm, mdipierro mdipie...@cs.depaul.edu wrote: In particular on windows and the @reboot option? Massimo -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: has anybody check the the cron in trunk?
Would this path be right c:/Python25/python.exe or this c:\Python25\python.exe or both? On Jan 29, 11:18 pm, mr.freeze nat...@freezable.com wrote: No but I'm getting this in the console on Windows 7: WARNING:root:WEB2PY CRON Call returned code 1: 'c:/Python25/python.exe\' is not recognized as an internal or external command, operable program or batch file. On Jan 29, 5:37 pm, mdipierro mdipie...@cs.depaul.edu wrote: In particular on windows and the @reboot option? Massimo -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.