newcron.py", line 227 AttributeError: 'list' object has no attribute 'split'

184 views
Skip to first unread message

szimszon

unread,
Jun 11, 2012, 8:19:45 AM6/11/12
to web...@googlegroups.com
http://code.google.com/p/web2py/issues/detail?id=849

Exception in thread Thread-21:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/home/szimszon/fejlesztes/sajat/web2py/gluon/newcron.py", line 227, in run
    proc = subprocess.Popen(self.cmd.split(),
AttributeError: 'list' object has no attribute 'split'


Version 2.00.0 (2012-06-10 01:18:28) dev

szimszon

unread,
Jun 11, 2012, 9:23:20 AM6/11/12
to web...@googlegroups.com
It's on the console where you start the web2py.py...

simon

unread,
Jun 11, 2012, 12:49:58 PM6/11/12
to web...@googlegroups.com
I also get this. It appears after the "cron fix" update to trunk.

Niphlod

unread,
Jun 11, 2012, 2:58:55 PM6/11/12
to web...@googlegroups.com
I'm running from source and I don't see the error, but I think I know what's going on.

Have you something in your applications crontab ?

also, are you on linux, mac or windows ?

szimszon

unread,
Jun 11, 2012, 3:13:59 PM6/11/12
to web...@googlegroups.com
I'm running it on Linux and I have nothing in cron. I use scheduler and linux crontab.

Niphlod

unread,
Jun 11, 2012, 3:31:31 PM6/11/12
to web...@googlegroups.com
uhm, maybe it's the default cron on admin that is giving error.

BTW, I'm getting an annoying pyfpdf window every time I start web2py from current trunk.

Fix is easy: when cron lines are defined as *applications/etc or **/applications/etc self.cmd becomes a list already for the intellingent parsing. Michael asked for allowing also custom processes to be run, but they required splitting, so we need to check if self.cmd is yet a list (usual cron lines) or not (custom processes)

@@ -223,8 +223,12 @@
         self.shell = shell
 
     def run(self):
+        if isinstance(self.cmd, (list,tuple)):
+            cmd = self.cmd
+        else:
+            cmd = self.cmd.split()
         import subprocess
-        proc = subprocess.Popen(self.cmd.split(),
+        proc = subprocess.Popen(cmd,
                                 stdin=subprocess.PIPE,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE,

Niphlod

unread,
Jun 11, 2012, 3:32:17 PM6/11/12
to web...@googlegroups.com
PS: forget about pyfpdf, I was importing the module directly.

Reply all
Reply to author
Forward
0 new messages