Re: [web2py] web2py scripts (homemade task queues) and python2 compatibility

2019-07-11 Thread Tom Clerckx
Anyone else that can shed some light on this?

On Friday, July 5, 2019 at 3:01:11 PM UTC+2, Tom Clerckx wrote:
>
> Hi Nico,
>
> I tried explicitly with python2.7, by executing: 
> python2.7 web2py.py -S examples -M -R 
> applications/examples/private/script01.py
>
> On a fresh downloaded version of web2py.
> Same result.
>
> In web2py/gluon/shell.py, I notice the following first line:
> from __future__ import print_function
>
> Funny enough, it's only trough an external script that I'm getting this 
> error.
> Using the print statement in a controller function, everything works as 
> expected.
> So I believe it's only when running an 'external' script 
> through web2py/gluon/shell.py that the print() function must be used.
>
> Or am I missing something/making a mistake?
>
> Best, Tom.
>
>
> On Thursday, July 4, 2019 at 10:45:30 PM UTC+2, Nico Zanferrari wrote:
>>
>> Hi Tom,
>>
>> even the latest  2.18.5 version of web2py is still fully compatible with 
>> Python 2.7.
>>
>> I think you're running both of your tests with python 3 ;-) 
>> Another possibility is that you've first run your web2py framework with 
>> python 3 and then with python 2 -  you cannot mix them without cleaning up 
>> caches and dbs... Try test02 a fresh copy of the web2py sources, after 
>> being sure to use python2!
>>
>> Nico
>>
>> Il giorno gio 4 lug 2019 alle ore 17:41 Tom Clerckx  
>> ha scritto:
>>
>>> Can anyone confirm that backward compatibility with python2 is broken 
>>> with respect to web2py scripts (or homemade task queueus)?
>>> I just downloaded version "2.18.5-stable+timestamp.2019.04.08.04.22.03" 
>>> and it looks like the python3 print() function must be used.
>>>
>>> Is there any plan to fix this? If not, it would be good to include this 
>>> information in the web2py book.
>>>
>>>
>>> Test01:
>>> =
>>> script "applications/examples/scrips/script01.py" containing only one 
>>> line:
>>> print("Test print")
>>>
>>> This one executes fine when running:
>>> python web2py.py -S examples -M -R 
>>> applications/examples/scrips/script01.py
>>>
>>>
>>> Test02:
>>> ==
>>> script "applications/examples/scrips/script01.py" containing only one 
>>> line:
>>> print "Test print"
>>>
>>> This one fails fine when running:
>>> python web2py.py -S examples -M -R 
>>> applications/examples/scrips/script01.py
>>>
>>> Traceback (most recent call last):
>>>   File "/home/tclerckx/Downloads/web2py/gluon/shell.py", line 275, in run
>>> execfile(startfile, _env)
>>>   File "applications/examples/scrips/script01.py", line 1
>>> print "Test print"
>>>  ^
>>> SyntaxError: invalid syntax
>>>
>>> -- 
>>> 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 web...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/web2py/4c095bb7-1cd8-47a2-9b71-94a735dd5681%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/cfd586b7-89dd-4a17-a16e-e65abd9a1c4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] web2py scripts (homemade task queues) and python2 compatibility

2019-07-05 Thread Tom Clerckx
Hi Nico,

I tried explicitly with python2.7, by executing: 
python2.7 web2py.py -S examples -M -R 
applications/examples/private/script01.py

On a fresh downloaded version of web2py.
Same result.

In web2py/gluon/shell.py, I notice the following first line:
from __future__ import print_function

Funny enough, it's only trough an external script that I'm getting this 
error.
Using the print statement in a controller function, everything works as 
expected.
So I believe it's only when running an 'external' script 
through web2py/gluon/shell.py that the print() function must be used.

Or am I missing something/making a mistake?

Best, Tom.


On Thursday, July 4, 2019 at 10:45:30 PM UTC+2, Nico Zanferrari wrote:
>
> Hi Tom,
>
> even the latest  2.18.5 version of web2py is still fully compatible with 
> Python 2.7.
>
> I think you're running both of your tests with python 3 ;-) 
> Another possibility is that you've first run your web2py framework with 
> python 3 and then with python 2 -  you cannot mix them without cleaning up 
> caches and dbs... Try test02 a fresh copy of the web2py sources, after 
> being sure to use python2!
>
> Nico
>
> Il giorno gio 4 lug 2019 alle ore 17:41 Tom Clerckx  > ha scritto:
>
>> Can anyone confirm that backward compatibility with python2 is broken 
>> with respect to web2py scripts (or homemade task queueus)?
>> I just downloaded version "2.18.5-stable+timestamp.2019.04.08.04.22.03" 
>> and it looks like the python3 print() function must be used.
>>
>> Is there any plan to fix this? If not, it would be good to include this 
>> information in the web2py book.
>>
>>
>> Test01:
>> =
>> script "applications/examples/scrips/script01.py" containing only one 
>> line:
>> print("Test print")
>>
>> This one executes fine when running:
>> python web2py.py -S examples -M -R 
>> applications/examples/scrips/script01.py
>>
>>
>> Test02:
>> ==
>> script "applications/examples/scrips/script01.py" containing only one 
>> line:
>> print "Test print"
>>
>> This one fails fine when running:
>> python web2py.py -S examples -M -R 
>> applications/examples/scrips/script01.py
>>
>> Traceback (most recent call last):
>>   File "/home/tclerckx/Downloads/web2py/gluon/shell.py", line 275, in run
>> execfile(startfile, _env)
>>   File "applications/examples/scrips/script01.py", line 1
>> print "Test print"
>>  ^
>> SyntaxError: invalid syntax
>>
>> -- 
>> 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 web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/4c095bb7-1cd8-47a2-9b71-94a735dd5681%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/e3cb8b21-1708-47bd-a776-4d594b432a46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] web2py scripts (homemade task queues) and python2 compatibility

2019-07-04 Thread Nico Zanferrari
Hi Tom,

even the latest  2.18.5 version of web2py is still fully compatible with
Python 2.7.

I think you're running both of your tests with python 3 ;-)
Another possibility is that you've first run your web2py framework with
python 3 and then with python 2 -  you cannot mix them without cleaning up
caches and dbs... Try test02 a fresh copy of the web2py sources, after
being sure to use python2!

Nico

Il giorno gio 4 lug 2019 alle ore 17:41 Tom Clerckx  ha
scritto:

> Can anyone confirm that backward compatibility with python2 is broken with
> respect to web2py scripts (or homemade task queueus)?
> I just downloaded version "2.18.5-stable+timestamp.2019.04.08.04.22.03"
> and it looks like the python3 print() function must be used.
>
> Is there any plan to fix this? If not, it would be good to include this
> information in the web2py book.
>
>
> Test01:
> =
> script "applications/examples/scrips/script01.py" containing only one line:
> print("Test print")
>
> This one executes fine when running:
> python web2py.py -S examples -M -R applications/examples/scrips/script01.py
>
>
> Test02:
> ==
> script "applications/examples/scrips/script01.py" containing only one line:
> print "Test print"
>
> This one fails fine when running:
> python web2py.py -S examples -M -R applications/examples/scrips/script01.py
>
> Traceback (most recent call last):
>   File "/home/tclerckx/Downloads/web2py/gluon/shell.py", line 275, in run
> execfile(startfile, _env)
>   File "applications/examples/scrips/script01.py", line 1
> print "Test print"
>  ^
> SyntaxError: invalid syntax
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/4c095bb7-1cd8-47a2-9b71-94a735dd5681%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAAE8D_AWT77sC-kwt5v72jx53nfSu2tzeH%3DqQcZjtPVSsyq6QQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] web2py scripts (homemade task queues) and python2 compatibility

2019-07-04 Thread Tom Clerckx
Can anyone confirm that backward compatibility with python2 is broken with 
respect to web2py scripts (or homemade task queueus)?
I just downloaded version "2.18.5-stable+timestamp.2019.04.08.04.22.03" and 
it looks like the python3 print() function must be used.

Is there any plan to fix this? If not, it would be good to include this 
information in the web2py book.


Test01:
=
script "applications/examples/scrips/script01.py" containing only one line:
print("Test print")

This one executes fine when running:
python web2py.py -S examples -M -R applications/examples/scrips/script01.py


Test02:
==
script "applications/examples/scrips/script01.py" containing only one line:
print "Test print"

This one fails fine when running:
python web2py.py -S examples -M -R applications/examples/scrips/script01.py

Traceback (most recent call last):
  File "/home/tclerckx/Downloads/web2py/gluon/shell.py", line 275, in run
execfile(startfile, _env)
  File "applications/examples/scrips/script01.py", line 1
print "Test print"
 ^
SyntaxError: invalid syntax

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/4c095bb7-1cd8-47a2-9b71-94a735dd5681%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.