Looks like shell.py imports print_function from __future__, which requires
use of the print() function. I suppose this should be considered a breaking
of backward compatibility, so feel free to report an issue on Github.
Anthony
On Tuesday, August 29, 2017 at 4:33:53 PM UTC-4, 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.
>
> 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
>
--
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.