[web2py] Re: Print statement fails in command line script (v2.15.3)

2017-08-30 Thread Jim Karsten
I'm using python version 2.7.12

On Tuesday, August 29, 2017 at 7:12:53 PM UTC-4, Dave S wrote:
>
>
>
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Print statement fails in command line script (v2.15.3)

2017-08-30 Thread Jim Karsten
Done: https://github.com/web2py/web2py/issues/1750
Thanks.
Jim

On Tuesday, August 29, 2017 at 9:41:49 PM UTC-4, Anthony wrote:
>
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Print statement fails in command line script (v2.15.3)

2017-08-29 Thread Anthony
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Print statement fails in command line script (v2.15.3)

2017-08-29 Thread Dave S


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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.