[web2py] Re: MySQL server has gone away - py4web

2020-02-21 Thread Marcello
It's  20191227.1





On Friday, February 21, 2020 at 12:48:32 AM UTC-3, Massimo Di Pierro wrote:
>
> Can you check which version of pydal you are using?
> Need to decide whether to make this the default behavior
>
> On Tuesday, 18 February 2020 03:35:47 UTC-8, Marcello wrote:
>>
>> Hi Massimo,
>>
>> Great !
>> Now worked fine...
>>
>> Thanks
>>
>>
>> On Tuesday, February 18, 2020 at 12:22:04 AM UTC-3, Massimo Di Pierro 
>> wrote:
>>>
>>> sorry. My bad. try:
>>>
>>> +self._adapter.reconnect()  
>>>
>>> On Sunday, 16 February 2020 19:17:25 UTC-8, Marcello wrote:

 I got this error:

   File "/home/parra/py4web/py4web/core.py", line 239, in on_request
 db._adapter.reconnect()
 NameError: name 'db' is not defined




 On Sunday, February 16, 2020 at 10:22:48 PM UTC-3, Massimo Di Pierro 
 wrote:
>
> The db fixture should automatiically try reconnect.
>
> To help me debug can you edit py4web/core.py and add the line below:
>
>  class DAL(pydal.DAL, Fixture):
>  def on_request(self):
>  threadsafevariable.ThreadSafeVariable.restore(ICECUBE)
> + db._adapter.reconnect()  
>
> Does it solve the problem?
>
>
> On Saturday, 15 February 2020 04:15:38 UTC-8, Marcello wrote:
>>
>> I'm with lastest version...
>>
>> Shouldn't reconnect to db every page load ???
>> If the server stays 1 hour without serving pages, a reconnection is 
>> needed... or not ?
>>
>>
>>
>>
>> On Saturday, February 15, 2020 at 8:30:58 AM UTC-3, Massimo Di Pierro 
>> wrote:
>>>
>>> My guess is that there is some timeout in the mysql config example.
>>> Can you repro with latest py4web?
>>>
>>> On Friday, 14 February 2020 14:31:58 UTC-8, Marcello wrote:

 Hi,

 Any informatiion about this ?
 Nobody using py4web with mysql ??



 On Tuesday, February 11, 2020 at 6:58:11 PM UTC-3, Marcello wrote:
>
> Hello,
>
> I'm trying py4web and found something stragne.
> Don't know if I'm making something wrong.
>
> I'm having "MySQL server has gone away" error if I wait some time 
> (about 10 minutes) betweeen page reloads...
>
> I tested same thing with web2py and this problem did not happen...
>
> Is it a bug or a problem here ?
>
>
> Thanks
> Marcello
>


-- 
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/4207ac23-ee5a-46d3-869b-700a0f5377a9%40googlegroups.com.


[web2py] How to use conda installed packages in web2py

2020-02-21 Thread Davidiam
Hi,

We have an application that requires the pandas package.  We thought we 
could just install pandas in the conda environment used for running web2py, 
but when we do "import pandas" in web2py we get an error message that it 
can't find pandas and it seems to be looking for pandas in the modules 
folder of the application.

There are a few similar questions that I found on Google but none of them 
had a clear answer.  Is it possible to import conda installed libraries in 
web2py applications without having to copy them (and all dependances) to 
within the web2py framework ?
If so, how can we do this ?


Here is the error we are getting :



web2py Web Framework

Created by Massimo Di Pierro, Copyright 2007-2020

Version 2.18.5-stable+timestamp.2019.04.08.04.22.03

Database drivers available: sqlite3, imaplib, pymysql, pyodbc

['', 'D:\\Data\\QFG\\site-packages', 'D:\\Data\\QFG', '
D:\\Data\\QFG\\gluon\\packages\\yatl', 'D:\\Data\\QFG\\gluon\\packages\\dal', 
'D:\\Python\\Miniconda3\\python37.zip', 'D:\\Python\\Miniconda3\\DLLs', '
D:\\Python\\Miniconda3\\lib', 'D:\\Python\\Miniconda3', '
D:\\Python\\Miniconda3\\lib\\site-packages', '
D:\\Python\\Miniconda3\\lib\\site-packages\\win32', '
D:\\Python\\Miniconda3\\lib\\site-packages\\win32\\lib', '
D:\\Python\\Miniconda3\\lib\\site-packages\\Pythonwin', '
D:\\Python\\Miniconda3\\envs\\web2py_QFG\\Lib\\site-packages']


Traceback (most recent call last):

  File "D:\Data\QFG\gluon\shell.py", line 275, in run

execfile(startfile, _env)

  File "D:\Data\QFG\gluon\shell.py", line 41, in execfile

exec(code, global_vars, local_vars)

  File "D:\Data\QFG\APPLiCATIONS\REPORTING\TEST\PythonInfo.py", line 14, in 


import pandas

  File "D:\Data\QFG\gluon\custom_import.py", line 85, in custom_importer

return base_importer(pname, globals, locals, fromlist, level)

*ModuleNotFoundError: No module named 'applications.CRE.modules.pandas'* 

 

 ---

Kind Regards,
David Rosalia

-- 
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/c4f5e113-9324-4578-b534-d1414a6aad2d%40googlegroups.com.


[web2py] unexpected end of stream - py4web

2020-02-21 Thread Edoardo Torrini
Hi 

I create a project client/server compose by an application mobile (client) 
and a webservice (py4web).
the application create request to the webservice and the server reply.
I add a request scheduling using the celery and redis.
I follow pass for pass the guide on the official py4web site.

the problem is that when I generete the get request from the app create an 
exception: "unexpected end of stream"
Someone know how to fix this issue?

Thanks
Edoardo Torrini

-- 
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/bdba800f-fa38-49a3-bc90-24d998df0c43%40googlegroups.com.


[web2py] py4web issue on get requests

2020-02-21 Thread Edoardo Torrini
Good morning,

I am a software developer and I want to create a project client-server.
The client is wrote in c# with xamarine and the server on py4web.
The client create request with some parameters and the server reply with a 
data in json form.
I use celery for scheduling the request and I create a task for each type 
of requests.

When with the client application I create a request [like the example 
below], the function await.response.Content.ReadAsStringAsync create an 
exception: *unexpected end of stream*

[image: Exception - Xamarine.png]


Server side the situation is that I create for each request a DAL and I 
define a table where I took the date to send to the client.
in this way:
[image: Controller - py4web.png]

I invoke  the task that reply the json file to the client in this way:

[image: task prd - py4web.png] 








































Someone know why the operation create this type of exception, I try using a 
request with chrome but the page was displayed correctly.
Thanks for the help.

Edoardo Torrini




-- 
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/a25df1ac-50b3-4033-a661-374577da6281%40googlegroups.com.


Re: [web2py] Re: ERROR on Request

2020-02-21 Thread Lovedie JC
Thanks.
I switched to it.
Regards

On Fri, Feb 21, 2020, 06:58 Massimo Di Pierro 
wrote:

> in py4web request is the bottlepy request.
> https://bottlepy.org/docs/dev/api.html#the-request-object
> There is no now.
>
> You can use datetime.timetime.now()
>
> On Tuesday, 18 February 2020 08:34:51 UTC-8, Maurice Waka wrote:
>>
>> BUT
>> Now I get this:
>>
>> Field('modified_on', 'datetime', default=request.now, update=request.now),
>>   File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 1400, in 
>> __getattr__
>> raise AttributeError('Attribute %r not defined.' % name)
>> AttributeError: Attribute 'now' not defined.
>>
>>
>> On Tuesday, February 18, 2020 at 7:13:27 PM UTC+3, Maurice Waka wrote:
>>>
>>> Thanks @Lovdie
>>>
>>> got
>>>
>>>
>>> from py4web import request,
>>>
>>> On Tuesday, February 18, 2020 at 6:58:10 PM UTC+3, Maurice Waka wrote:

 In py4web, I cant use this syntax:
 default = request.now


 Error:

 Field('modified_on', 'datetime', default=request.now),# 
 update=request.now),
 NameError: name 'request' is not defined

 --
> 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/ebc49b2d-ed20-4fd9-9aa0-ee94a7f4cfde%40googlegroups.com
> 
> .
>

-- 
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/CAAcHJF-T%3DzbWLD4-6_CqdwZpk%3DSfVK4OtYHhHKvYxho9sEs0yg%40mail.gmail.com.


[web2py] Re: py4web issue on get requests

2020-02-21 Thread Dave S


On Friday, February 21, 2020 at 8:38:08 PM UTC-8, Edoardo Torrini wrote:
>
> Good morning,
> [image: task prd - py4web.png]
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Someone know why the operation create this type of exception, I try using 
> a request with chrome but the page was displayed correctly.
> Thanks for the help.
>
>
I'm surprised that the "return" is inside the json.dumps().  I would expect 
it to be the other way around.

/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/2c282064-1aba-4349-a244-933dd1b77a31%40googlegroups.com.