[web2py] Re: Error trying to go back to python 2 after testing python 3: TypeError: translate() takes exactly one argument (2 given)

2019-10-10 Thread Massimo Di Pierro
I am puzzled by this too. The error is not in web2py code. The error is in 
the string.py module.
Also in your json example you are getting unicode both in py2 and py3 
except py3 does not put the u'' in front of unicode strings because they 
are default.

On Thursday, 10 October 2019 18:05:55 UTC-7, Lisandro wrote:
>
> I've found the issue, it's not web2py related, sorry about that.
>
> My web2py instance has several applications running, each one is attached 
> to a domain.
> I store a the map of domains:apps in a dictionary that I save to a .pkl 
> file.
> Then my routes.py reads that file and loads the map of domains:apps
>
> I write the .pkl file like this:
>
> with open('map.pkl', 'wb') as file:
> pickle.dump(dictionary_map, file, protocol=2)
>
> Notice I use protocol=2 because I want to be able to read/write the file 
> with python 2 and 3.
>
> In my routes.py I read the file like this:
>
> map = pickle.load(open('domains_apps.pkl', 'rb'))
>
> routers = dict(
> BASE=dict(
> default_controller='default',
> default_function='index',
> domains=map,
> map_static=True,
> exclusive_domain=True,
> )
> )
>
>
>
> However, after writing .pkl the file with python 3 and returning to python 
> 2, my applications fail with the error reported in my first message. The 
> error goes away if I replace the .pkl file with an old backup I had made 
> before using python 2.
>
> I have noticed that once the .pkl file is written with python 3, then 
> reading it with python 2 and 3 throws different results:
>
> *with python 3*:
> >>> r = pickle.load(open('domains_apps.pkl', 'rb'))
> >>> print(r)
> {'prod.com': 'prod', 'test.com': 'test'}
>
>
> *with python 2*:
> >>> r = pickle.load(open('domains_apps.pkl', 'rb'))
> >>> print(r)
> {*u*'prod.com': *u*'prod', *u*'test.com': *u*'test'}
>
>
> Notice that in python 2 reading the .pkl file (that was written with 
> python 3 using protocol=2) returns unicode strings. This doesn't happen in 
> python 3. But i'm not sure what protocol to use. 
>
> I'll do some more tests and I'll post here whatever solution I can find. 
> Thanks for your time!
> Regards,
> Lisandro.
>
>
>
>
>
> El jueves, 10 de octubre de 2019, 21:21:53 (UTC-3), Dave S escribió:
>>
>> Delete all the .pyc files?
>>
>>
>> /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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/29314194-7f4b-44cb-85a2-d9da5f5098a2%40googlegroups.com.


[web2py] ImportError: No module named utils on websocket_messaging

2019-10-10 Thread Luis Sucuc

I am trying to use sockets as follows

python gluon/contrib/websocket_messaging.py -k 123 -p 

but I receive the following error

Traceback (most recent call last):
  File "gluon/contrib/websocket_messaging.py", line 96, in 
import gluon.utils
ImportError: No module named utils
luis@luissucuc:~/Documents/Innovare/




SO: Ubuntu 18.04.3 LTS

Version

2.18.5-stable+timestamp.2019.04.08.04.22.03
(Running on Rocket 1.2.6, Python 2.7.15+)

-- 
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/71f99f60-ede3-4752-a45c-f5d7de660337%40googlegroups.com.


[web2py] Changing the css framework

2019-10-10 Thread Jay B
Hello guys,

i'd like to use another css framework for my web2py app. Is there a easy 
way to replace it and start with a fresh new app? 

Greetz
Jay

-- 
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/b7c8be62-36a9-4f3d-a077-cdcff2dc72df%40googlegroups.com.


[web2py] py4web

2019-10-10 Thread Kevin Fonseca
hi, i would like to now what will happen with web2py when py4web is 
implemented?

-- 
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/4312c5ab-2fab-4e51-9914-352bf8d400ca%40googlegroups.com.


[web2py] problems running PY4WEB

2019-10-10 Thread Kevin Fonseca
i am having problems when i tried to run PY4WEB 
de error log is :

2019-10-10 13:23:10,259: Error running WSGI application
2019-10-10 13:23:10,277: FileNotFoundError: [Errno 2] No such file or 
directory: 'apps/__init__.py'
2019-10-10 13:23:10,277:   File 
"/var/www/kevin2811_pythonanywhere_com_wsgi.py", line 22, in 
2019-10-10 13:23:10,277: from bottle_app import application
2019-10-10 13:23:10,278: 
2019-10-10 13:23:10,278:   File "/home/kevin2811/bottle_app.py", line 4, in 

2019-10-10 13:23:10,278: application = wsgi(password_file=password_file, 
dashboard_mode='full')
2019-10-10 13:23:10,278: 
2019-10-10 13:23:10,278:   File 
"/home/kevin2811/.local/lib/python3.7/site-packages/py4web/core.py", line 771, 
in wsgi
2019-10-10 13:23:10,279: Reloader.import_apps()
2019-10-10 13:23:10,279: 
2019-10-10 13:23:10,279:   File 
"/home/kevin2811/.local/lib/python3.7/site-packages/py4web/core.py", line 664, 
in import_apps
2019-10-10 13:23:10,279: 'apps', path).load_module()
2019-10-10 13:23:10,279: ***
2019-10-10 13:23:10,280: If you're seeing an import error and don't know why,
2019-10-10 13:23:10,281: we have a dedicated help page to help you debug: 
2019-10-10 13:23:10,281: 
https://help.pythonanywhere.com/pages/DebuggingImportError/
2019-10-10 13:23:10,281: ***
2019-10-10 13:23:13,431: Error running WSGI application
2019-10-10 13:23:13,433: FileNotFoundError: [Errno 2] No such file or 
directory: 'apps/__init__.py'
2019-10-10 13:23:13,434:   File 
"/var/www/kevin2811_pythonanywhere_com_wsgi.py", line 22, in 
2019-10-10 13:23:13,435: from bottle_app import application
2019-10-10 13:23:13,435: 
2019-10-10 13:23:13,436:   File "/home/kevin2811/bottle_app.py", line 4, in 

2019-10-10 13:23:13,437: application = wsgi(password_file=password_file, 
dashboard_mode='full')
2019-10-10 13:23:13,438: 
2019-10-10 13:23:13,438:   File 
"/home/kevin2811/.local/lib/python3.7/site-packages/py4web/core.py", line 771, 
in wsgi
2019-10-10 13:23:13,441: Reloader.import_apps()
2019-10-10 13:23:13,441: 
2019-10-10 13:23:13,442:   File 
"/home/kevin2811/.local/lib/python3.7/site-packages/py4web/core.py", line 664, 
in import_apps
2019-10-10 13:23:13,442: 'apps', path).load_module()
2019-10-10 13:23:13,442: ***
2019-10-10 13:23:13,443: If you're seeing an import error and don't know why,
2019-10-10 13:23:13,443: we have a dedicated help page to help you debug: 
2019-10-10 13:23:13,443: 
https://help.pythonanywhere.com/pages/DebuggingImportError/
2019-10-10 13:23:13,444: ***
2019-10-10 13:23:13,895: Error running WSGI application
2019-10-10 13:23:13,896: FileNotFoundError: [Errno 2] No such file or 
directory: 'apps/__init__.py'
2019-10-10 13:23:13,896:   File 
"/var/www/kevin2811_pythonanywhere_com_wsgi.py", line 22, in 
2019-10-10 13:23:13,896: from bottle_app import application
2019-10-10 13:23:13,897: 
2019-10-10 13:23:13,897:   File "/home/kevin2811/bottle_app.py", line 4, in 

2019-10-10 13:23:13,898: application = wsgi(password_file=password_file, 
dashboard_mode='full')
2019-10-10 13:23:13,898: 
2019-10-10 13:23:13,898:   File 
"/home/kevin2811/.local/lib/python3.7/site-packages/py4web/core.py", line 771, 
in wsgi
2019-10-10 13:23:13,899: Reloader.import_apps()
2019-10-10 13:23:13,899: 
2019-10-10 13:23:13,900:   File 
"/home/kevin2811/.local/lib/python3.7/site-packages/py4web/core.py", line 664, 
in import_apps
2019-10-10 13:23:13,900: 'apps', path).load_module()
2019-10-10 13:23:13,900: ***
2019-10-10 13:23:13,900: If you're seeing an import error and don't know why,
2019-10-10 13:23:13,900: we have a dedicated help page to help you debug: 
2019-10-10 13:23:13,901: 
https://help.pythonanywhere.com/pages/DebuggingImportError/
2019-10-10 13:23:13,901: ***

-- 
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/cfb51fdb-accd-4c22-9cdb-440f1ccdacb5%40googlegroups.com.


[web2py] New User Install gets Error Mac OSX High Sierra

2019-10-10 Thread OogieM
Brand new user. Downloaded the Normal Users Mac version. UnZipped and tried 
to run web2py.app get this error with no other useful information. 

System is 10.13.6 High Sierra on an older iMac.

Never got the window to select a password or get started. I did verify that 
no other versions of web2py were present on the system.

Tried deleting everything and redownloaded it just in case but got the same 
error. 

Looked at Console but nothing listed web2py as a problem but I'm not 
skilled in reading console messages.

Suggestions as to what to try next.?

-- 
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/8f8fd99f-be89-4248-98db-fe821f5790d1%40googlegroups.com.


[web2py] How to easily implement another CSS-Framework

2019-10-10 Thread Jay B
Hello guys,

I'm trying to figure out how to include another CSS framework instead of 
bootstrap. But the fact that the layout.html and other files point to the 
bootstrap files makes it harder than I thought. 

I would like to test other CSS frameworks like Semantic UI or Bulma instead 
of Bootstrap and wonder how to do it best. Or am I forced to delete all CSS 
files and standard views?

I would be happy if you could help me and thank you in advance for all the 
tips.

Greetz
Jay

-- 
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/0ab50fdb-5d9c-442a-a6d7-2a2bcad2bec7%40googlegroups.com.


[web2py] Where do we place the routes.py file?

2019-10-10 Thread Power Vault
Hi guys, i was attempting to change the way URLs appear on the address bar 
and I read somewhere that is has to be done in the routes.py file. Now my 
issue is i dont know where exactly to place the routes.py file, where do i 
place it & how do i refresh it in the admin interface?

Thank you.

-- 
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/d30bbe51-5966-43cc-ac2e-1dda03095524%40googlegroups.com.


[web2py] Bugfixes for older versions of Web2Py?

2019-10-10 Thread Bruno Heremans
Something I didn't find in the documentation 
:
 
are important bugfixes applied to older versions? 

Bugfixes don't need to be applied to ALL other versions, but going back 1 
or 2 minor versions would be nice. When a Web2Py environment is fully 
integrated, updating the core is usually something that takes time... 

Is there an agreement or a rule on this? 

-- 
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/9b3d48c9-f053-4b68-9801-9f6cd4ce61b8%40googlegroups.com.


[web2py] Beginner can't get past install

2019-10-10 Thread OogieM
New user trying to install web2py on Mac High Sierra 10.13.6

Downloaded the for users mav cersion, unzipped, verified I have python 
installed. I tried to run the web2py app and get a error message "web2py 
Error" 2 buttons, open console or terminate. Tried looking at the console 
but I can't see anything useful there. 

Not even sure how to debug this since I can't even get to the window asking 
to create the admin password or get the app to run. 

-- 
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/0f750974-e677-416a-881c-4735e0d213a9%40googlegroups.com.


[web2py] Re: Error trying to go back to python 2 after testing python 3: TypeError: translate() takes exactly one argument (2 given)

2019-10-10 Thread Lisandro
I've found the issue, it's not web2py related, sorry about that.

My web2py instance has several applications running, each one is attached 
to a domain.
I store a the map of domains:apps in a dictionary that I save to a .pkl 
file.
Then my routes.py reads that file and loads the map of domains:apps

I write the .pkl file like this:

with open('map.pkl', 'wb') as file:
pickle.dump(dictionary_map, file, protocol=2)

Notice I use protocol=2 because I want to be able to read/write the file 
with python 2 and 3.

In my routes.py I read the file like this:

map = pickle.load(open('domains_apps.pkl', 'rb'))

routers = dict(
BASE=dict(
default_controller='default',
default_function='index',
domains=map,
map_static=True,
exclusive_domain=True,
)
)



However, after writing .pkl the file with python 3 and returning to python 
2, my applications fail with the error reported in my first message. The 
error goes away if I replace the .pkl file with an old backup I had made 
before using python 2.

I have noticed that once the .pkl file is written with python 3, then 
reading it with python 2 and 3 throws different results:

*with python 3*:
>>> r = pickle.load(open('domains_apps.pkl', 'rb'))
>>> print(r)
{'prod.com': 'prod', 'test.com': 'test'}


*with python 2*:
>>> r = pickle.load(open('domains_apps.pkl', 'rb'))
>>> print(r)
{*u*'prod.com': *u*'prod', *u*'test.com': *u*'test'}


Notice that in python 2 reading the .pkl file (that was written with python 
3 using protocol=2) returns unicode strings. This doesn't happen in python 
3. But i'm not sure what protocol to use. 

I'll do some more tests and I'll post here whatever solution I can find. 
Thanks for your time!
Regards,
Lisandro.





El jueves, 10 de octubre de 2019, 21:21:53 (UTC-3), Dave S escribió:
>
> Delete all the .pyc files?
>
>
> /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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7ea86508-b90f-4197-96a8-11a1f7ecbdb5%40googlegroups.com.


[web2py] Password field getting cleared

2019-10-10 Thread App Jar
Is there a way to keep the auth password and password_two fields from 
getting cleared when the auth register form has errors in it?

Every time there is an error in my form both fields get cleared requiring 
the user to enter the password again twice, once for each field.

I can keep the password field with the following code, but since 
password_two gets generated automatically in Auth() I can't keep its value.

# Works for password field but no equivilant for password_two
if request.vars.password:
   db.auth_user.password.default = request.vars.password





-- 
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/d2fb313c-b1c6-425a-859c-8db5e4046b8d%40googlegroups.com.


[web2py] Error trying to go back to python 2 after testing python 3: TypeError: translate() takes exactly one argument (2 given)

2019-10-10 Thread Dave S
Delete all the .pyc files?


/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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1c4ea776-374e-4543-84e4-0b43c19cd45e%40googlegroups.com.


[web2py] Error trying to go back to python 2 after testing python 3: TypeError: translate() takes exactly one argument (2 given)

2019-10-10 Thread Lisandro
I'm testing my web2py application to see what I need to fix in order to 
make it compatible with python3.
I'm using web2py Version 2.17.1-stable+timestamp.2018.08.06.01.02.56

My application has been running with python2 for a long time.
Yesterday I tried with python3 (setting up a virtual environment) and 
everything went ok.
But now *I can't go back to use python2*, any request to the application 
fails with this error:


TypeError: translate() takes exactly one argument (2 given) 


Traceback (most recent call last):
  File "/home/gonguinguen/medios/gluon/main.py", line 435, in wsgibase
session.connect(request, response)
  File "/home/gonguinguen/medios/gluon/globals.py", line 996, in connect
response.cookies[response.session_id_name] = response.session_id
  File "/usr/lib64/python2.7/Cookie.py", line 592, in __setitem__
self.__set(key, rval, cval)
  File "/usr/lib64/python2.7/Cookie.py", line 585, in __set
M.set(key, real_value, coded_value)
  File "/usr/lib64/python2.7/Cookie.py", line 459, in set
if "" != translate(key, idmap, LegalChars):
  File "/usr/lib64/python2.7/string.py", line 493, in translate
return s.translate(table, deletions)
TypeError: translate() takes exactly one argument (2 given)



I've already flushed redis cache, restarted webserver, cleared browser 
data... 
Any other suggestion?

Thanks in advance
Regards,
Lisandro

-- 
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/0a769bb3-f54f-4024-9917-492d74a3549c%40googlegroups.com.