On Tuesday, August 29, 2017 at 1:33:53 PM UTC-7, Jim Karsten wrote:
>
> I run many scripts from the command line. After upgrading to v2.15.3, I
> find print statements produce a SyntaxError. If I convert the statements to
> a print function it works. This was not a problem in v2.14.6.
>
>
What python version are you running?
I have a few controller functions that I run with -S, but I don't have them
on my 2.15.3 instance at the moment. But I do have URL-accessed
controllers with print statements, and those seem fine ... 2.15.3, Python
2.7.3 (on an antique Fedora).
> To illustrate:
>
> $ cat test.py
> #!/usr/bin/env python
> if __name__ == '__main__':
> print 'Hello!'
>
> $ python web2py.sh --no-banner -S myapp -R test.py
> Traceback (most recent call last):
> File "/srv/http/web2py/2.15.3/web2py/gluon/shell.py", line 270, in run
> execfile(startfile, _env)
> File "/root/tmp/test.py", line 4
> print 'abc'
> SyntaxError: invalid syntax
>
> This works:
>
> $ cat test2.py
> #!/usr/bin/env python
> if __name__ == '__main__':
> print('Hello!')
>
> $ python web2py.py --no-banner -S myapp -R test2.py
> Hello!
>
> Is this is expected behaviour? Is there a command line option, or a small
> change that permits cli scripts to continue to accept python2 syntax?
>
> Thanks,
> Jim
>
/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.