On Wednesday, October 25, 2017 at 12:02:12 AM UTC-7, Dave S wrote:
>
>
>
> On Monday, October 23, 2017 at 3:38:27 PM UTC-7, Dave S wrote:
>>
>> In my 2.15.x testing, I've been concentrating on the https interface,
>> but I now tried to do a -M -S that would queue up a Scheduler task. And I
>> ran into an unexpected problem with syntax errors on print statements.
>>
>> if when:
>> print "ri_s: when " + when
>>
>> Even when I shorten the line to remove the concatenation, I get a syntax
>> error:
>>
>> Traceback (most recent call last):
>> File "web2py.py", line 33, in <module>
>> gluon.widget.start(cron=True)
>> File "/home/ec2-user/web2py/web2py-2.15.4/web2py/gluon/widget.py",
>> line 1152, in start
>> cronjob=options.cronjob)
>> File "/home/ec2-user/web2py/web2py-2.15.4/web2py/gluon/shell.py", line
>> 258, in run
>> execfile(pyfile, _env)
>> File "applications/updater/controllers/default.py", line 140
>> print "ri_s: when "
>> ^
>> SyntaxError: invalid syntax
>>
>> I tried changing the variable name to "pwhen" in case this was an
>> if-statement/keyword issue, but still "invalid syntax".
>>
>> As you might guess, default.py loads fine for https requests, and this
>> code loads fine with -S under 2.14.6, so I'm not sure what's going on here.
>>
>
> Changing the print statements to logger calls allows the -S load to
> complete, but I don't think anything went to web2py.log from these calls
> (logging calls used when handling http(s) requests seem to be working
> normally).
>
> Plus, when you're running from the command line (as is often the case for
> -S), it's irritating to have to go to the log for what is ordinarily stdout
> material.
>
> /dps
>
I think I've found the cause: in 2.15.4, gluon/shell.py has the line
from __future__ import print_function
I have an "add_user.py" script picked up some time ago from the group,
which I was running with -S, and the print statements were getting syntax
errors. Changing
print "..."
to
print ("...")
fixed things. I haven't gone to my other system to see if that would fix
the module from the original post.
/dps
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.