Re: [web2py] On Windows I am trying to delete an application that uses logging but the delete fails because the log file is "in use"

2020-11-10 Thread AGRogers
Good tip. Thanks. Seems like something that should end up in the public
version.

___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Tue, 10 Nov 2020 at 23:09, Davidiam  wrote:

> We found that by modifying the gluon\admin.py app_uninstall function, we
> could search for the open log file handles and close them before the actual
> delete of the files is performed.
>
>import logging
>import logging.handlers
>
>for nm, lgr in logging.root.manager.loggerDict.items():
>   if str(nm) == str(app):
>  for h in lgr.handlers:
> h.close()
> On Tuesday, October 27, 2020 at 2:09:51 PM UTC+1 Davidiam wrote:
>
>> It looks like it uses one handler although the logger rotates the actual
>> log files.  I think that I would need to shut down the logger before or at
>> the beginning of the uninstall step, but as the "uninstall application" is
>> run from the admin app, it would be a bit tricky to implement the shutdown
>> for a specific application in the admin application code.  If there was an
>> app.shutdown() method maybe
>>
>> For the moment I am first shutting down the application pool in IIS and
>> then deleting the app but I would prefer a coded solution.  We son't delete
>> applications aften, so the work-around is acceptable for the moment.
>>
>> On Tuesday, October 27, 2020 at 4:23:09 AM UTC+1 roge...@gmail.com wrote:
>>
>>> Ah, i see. Can you temporarily shutdown() the logger and then restart it
>>> when the uninstall is complete? Or does it need to stay running also? I
>>> think it is possible to close a specific handler as well - but i dont know
>>> how the logging works in web2py - maybe there is a single handler for all
>>> the apps (if you can't tell, i have never used it before :)
>>>
>>>
>>> ___
>>> *www.TenOutOfTen.org* 
>>> roge...@gmail.com
>>> (+95) 09 250018669 <+95%209%20250%20018%20669> (Myanmar)
>>>
>>>
>>> On Mon, 26 Oct 2020 at 23:37, Davidiam  wrote:
>>>
 Thank you for your reply,
 Deleting the application folder gives the same error.
 The problem is that the logger holds the log file locked.  If I restart
 the webserver I can delete the file, but our developers can't restart web
 services.
 It is not a big problem but I would like to find a solution (if one
 exists)..

 On Monday, October 26, 2020 at 4:56:30 AM UTC+1 roge...@gmail.com
 wrote:

> Hi David
>
> I am not sure that i have ever used the Uninstall option. I just
> delete the application folder and the application disappears. I am not 
> sure
> if that leaves any residual information in files somewhere. But i have not
> noticed a problem.
>
> Does that work for you?
> Andrew
>
> ___
> *www.TenOutOfTen.org* 
> roge...@gmail.com
> (+95) 09 250018669 <+95%209%20250%20018%20669> (Myanmar)
>
>
>
> On Fri, 23 Oct 2020 at 17:07, Davidiam  wrote:
>
>> When using logging in web2py on Windows, we are unable to delete
>> applications unless we first stop the server.
>>
>> The reason is that the app.log is considered "in use".
>>
>> As the uninstall happens from the admin app, I am not quite sure how
>> best to stop the logger in the application that is being uninstalled when
>> the "Uninstall" option is selected from admin.
>>
>> Anyone have any ideas on how to unistall an app that uses logging.
>> Apparently this is only an issue on Windows because the os.unlink works 
>> on
>> "in use" files on linux systems.
>>
>> Note : We have defined the location of the log files within the
>> application directory structure so that the developers have access to the
>> files.
>>
>> This is the logging code used :
>> def get_configured_logger(name):
>> Test = False
>> logger = logging.getLogger(name)
>> if (len(logger.handlers) == 0):
>> # This logger has no handlers, so we can assume it hasn't yet
>> been configured
>> # (Configure logger)
>>
>> # Create default handler
>> if request.env.web2py_runtime_gae:
>> # Create GAEHandler
>> handler = GAEHandler()
>> else:
>> # Create RotatingFileHandler
>> import os
>> formatter="%(asctime)s %(levelname)s %(process)s %(thread)s
>> %(funcName)s():%   (lineno)d %(message)s"
>> handler =
>> logging.handlers.RotatingFileHandler(os.path.join(request.folder,
>> 'private/app.log'), maxBytes=100,backupCount=2)
>> handler.setFormatter(logging.Formatter(formatter))
>>
>> handler.setLevel(logging.DEBUG)
>>
>> logger.addHandler(handler)
>> logger.setLevel(logging.DEBUG)
>>
>> # Test entry:
>>
>> if Test == 

[web2py] Re: Error: Connection lost during download

2020-11-10 Thread Clemens
Same as Jim: I have experience with nginx and uwsgi.

And googling " set timeout" should give you the answer, 
e.g.:
https://ubiq.co/tech-blog/increase-request-timeout-nginx/
https://httpd.apache.org/docs/2.4/mod/core.html#keepalivetimeout

If it's not a timeout problem (but I'm sure it is), I could be a 
restriction in the size of the data transferable per request. But please 
first try to increase the timeout.

Clemens
On Tuesday, November 10, 2020 at 10:20:52 PM UTC+1 Jim S wrote:

> That depends on your software stack. 
>
> Where is this hosted?
>
> What web server?
>
> Are you using uwsgi?
>
> I have experience with nginx and uwsgi but not much else.  
>
> -Jim
>
>
> On Tuesday, November 10, 2020 at 3:10:28 PM UTC-6, SR wrote:
>>
>> How do I fix this? Any suggestion would be appreciated.
>>
>> On Tuesday, November 10, 2020 at 11:47:53 AM UTC-6 Clemens wrote:
>>
>>> If I had to guess, I'd say, that your web server is running in a 
>>> timeout while downloading such a large file.
>>>
>>> Best regards
>>> Clemens
>>>
>>> On Tuesday, November 10, 2020 at 6:41:35 PM UTC+1 SR wrote:
>>>
 Hi
 I store my uploaded file in the web2py "static" folder.
 One of the download link for linux binaries fails.  It downloads 1GB, 
 then fails.
 This is the link:

 https://cryoem.bcm.edu/cryoem/static/software/continuous_build/eman2_sphire_sparx_huge.linux.unstable.sh
 . 
 Is this problem due to the file is larger than 1GB? Could it be related 
 to one of the server settings?
 Could you help me figure out what is going on?
 Thank you very much in advance.

 Regards
 Sneka.

>>>

-- 
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/a6ba4864-b5aa-4995-89d5-4a6fdfeb869en%40googlegroups.com.


[web2py] Re: Error: Connection lost during download

2020-11-10 Thread Jim S
That depends on your software stack. 

Where is this hosted?

What web server?

Are you using uwsgi?

I have experience with nginx and uwsgi but not much else.  

-Jim


On Tuesday, November 10, 2020 at 3:10:28 PM UTC-6, SR wrote:
>
> How do I fix this? Any suggestion would be appreciated.
>
> On Tuesday, November 10, 2020 at 11:47:53 AM UTC-6 Clemens wrote:
>
>> If I had to guess, I'd say, that your web server is running in a timeout 
>> while downloading such a large file.
>>
>> Best regards
>> Clemens
>>
>> On Tuesday, November 10, 2020 at 6:41:35 PM UTC+1 SR wrote:
>>
>>> Hi
>>> I store my uploaded file in the web2py "static" folder.
>>> One of the download link for linux binaries fails.  It downloads 1GB, 
>>> then fails.
>>> This is the link:
>>>
>>> https://cryoem.bcm.edu/cryoem/static/software/continuous_build/eman2_sphire_sparx_huge.linux.unstable.sh
>>> . 
>>> Is this problem due to the file is larger than 1GB? Could it be related 
>>> to one of the server settings?
>>> Could you help me figure out what is going on?
>>> Thank you very much in advance.
>>>
>>> Regards
>>> Sneka.
>>>
>>

-- 
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/79156d19-81cb-42d8-89e0-246bfc2b4ee7o%40googlegroups.com.


[web2py] Re: Error: Connection lost during download

2020-11-10 Thread SR
How do I fix this? Any suggestion would be appreciated.

On Tuesday, November 10, 2020 at 11:47:53 AM UTC-6 Clemens wrote:

> If I had to guess, I'd say, that your web server is running in a timeout 
> while downloading such a large file.
>
> Best regards
> Clemens
>
> On Tuesday, November 10, 2020 at 6:41:35 PM UTC+1 SR wrote:
>
>> Hi
>> I store my uploaded file in the web2py "static" folder.
>> One of the download link for linux binaries fails.  It downloads 1GB, 
>> then fails.
>> This is the link:
>>
>> https://cryoem.bcm.edu/cryoem/static/software/continuous_build/eman2_sphire_sparx_huge.linux.unstable.sh
>> . 
>> Is this problem due to the file is larger than 1GB? Could it be related 
>> to one of the server settings?
>> Could you help me figure out what is going on?
>> Thank you very much in advance.
>>
>> Regards
>> Sneka.
>>
>

-- 
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/497258a6-da49-4c7d-810d-37d5dc817dc8n%40googlegroups.com.


[web2py] Re: InFailedSqlTransaction

2020-11-10 Thread Jim S
I was guessing that you were missing a field in your scheduled_task table.  
I don't know when it happened, but at some point an additional field was 
added to the table.  I'm confused as to why your migrate didn't work though 
to rebuild everything.  Well, glad you have it all working now.

-Jim


On Tuesday, November 10, 2020 at 12:04:11 PM UTC-6, Gaël Princivalle wrote:
>
> > Did you go in to the application so that db.py would be executed, 
> thereby triggering the migration to happen? 
> Yes, after each modification of the DB connection string I reload a 
> website page.
>
> I've resolved this problem moving the scheduler tables in another DB.
>
> Thanks for your help.
> Il giorno martedì 10 novembre 2020 alle 15:45:43 UTC+1 Jim S ha scritto:
>
>> Did you go in to the application so that db.py would be executed, thereby 
>> triggering the migration to happen?
>>
>> -Jim
>>
>> On Tuesday, November 10, 2020 at 8:33:41 AM UTC-6, Gaël Princivalle wrote:
>>>
>>> Thank you Jim.
>>>
>>> I've setted migrate to False and fake-migrate to True.
>>> Deleted the scheduler tables in the database folder
>>> Setted migrate to True and fake-migrate to False
>>> And the tables are not rebuild in the DB.
>>> The error still the same.
>>>
>>> I'll try to delete the scheduler.py file, export the db, import it in a 
>>> new db and add again the scheduler...
>>>
>>> Il giorno martedì 10 novembre 2020 alle 15:20:36 UTC+1 Jim S ha scritto:
>>>
 Can you go to the databases directory in your app and delete the 
 scheduler tables from there?  Then make sure your db connection has 
 migrate=True specified along with fake-migrate=False.

 I'm thinking that should force a rebuild of the scheduler tables in 
 your database.

 -Jim


 On Tuesday, November 10, 2020 at 3:02:15 AM UTC-6, Gaël Princivalle 
 wrote:
>
> I've deleted the scheduler.py file and deleted the scheduler tables.
> Now if I add again the scheduler.py file the scheduler tables are in 
> the admin but not in the DB, and the error is the same for all the 
> scheduler tables, InFailedSqlTransaction.
>
> Someone can help me?
>
> Il giorno domenica 8 novembre 2020 alle 21:08:45 UTC+1 Gaël 
> Princivalle ha scritto:
>
>> We talk about the db.scheduler_task table. I've deleted all the 
>> records from this table, and also from db.scheduler_run and 
>> db.scheduler_worker.
>>
>> No way.
>>
>> Il giorno domenica 8 novembre 2020 alle 20:57:23 UTC+1 Gaël 
>> Princivalle ha scritto:
>>
>>> Hi.
>>>
>>> Someone knows what it means?
>>>
>>> After a server change I'm able in the Admin to modify the table 
>>> records but not the one of the scheduler.
>>>
>>> Any idea?
>>>
>>> Traceback (most recent call last):
>>>   File "/home/user/apps/web2py_folder/web2py/gluon/main.py", line 
>>> 456, in wsgibase
>>> session._try_store_in_db(request, response)
>>>   File "/home/user/apps/web2py_folder/web2py/gluon/globals.py", line 
>>> 1251, in _try_store_in_db
>>> if not table._db(table.id == record_id).update(**dd):
>>>   File 
>>> "/home/user/apps/web2py_folder/web2py/gluon/packages/dal/pydal/objects.py",
>>>  
>>> line 2686, in update
>>> ret = db._adapter.update(table, self.query, row.op_values())
>>>   File 
>>> "/home/user/apps/web2py_folder/web2py/gluon/packages/dal/pydal/adapters/base.py",
>>>  
>>> line 579, in update
>>> raise e
>>> InFailedSqlTransaction: current transaction is aborted, commands 
>>> ignored until end of transaction block
>>>
>>

-- 
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/ff906acf-ae85-40fd-9e34-beffa8cbdc5ao%40googlegroups.com.


Re: [web2py] Displaying content based on the id attribute

2020-11-10 Thread mostwanted
Oh ok, that makes sense, that could've worked

On Monday, November 9, 2020 at 4:37:52 PM UTC+2 roge...@gmail.com wrote:

> That was a long thread which I didn't read fully. But what I did read made 
> me think that maybe the original problem was that you needed a slight delay 
> between when you showed the span and when you made the ajax call. I do that 
> by putting the ajax call in a setTimeout function. If I don't, the screen 
> doesn't update until the ajax call is completed. 
>
> On Tue, 3 Nov 2020, 7:36 pm mostwanted,  wrote:
>
>> I have a hidden span that i want displayed when a link is clisked while 
>> waiting for the page to load but this is not working! I dont know where I 
>> am going wrong but thought I had it right, please assist me.
>>
>> *CSS:*
>> .link_loader
>> {
>> display: none;
>> }
>>
>> *CONTROLLER*
>> *#The yellow line is the hidden span that has the loader I want to 
>> display*
>> def ajaxlivesearch():
>> keywords = request.vars.keywords
>> print "Keywords: " + str(keywords)
>>
>> if keywords:
>> query = reduce(lambda 
>> a,b:a,[db.services.service_name.contains(k) for k in keywords.split()])
>> services = db(query).select()
>> items = []
>>
>> if services:
>> for c in services: 
>> items.append(DIV*(SPAN("loading ...", SPAN(_class="fa 
>> fa-spinner fa-spin"), _class="link_loader", 
>> data={'id':"res%s"%c.service_name})*, A(c.service_name, 
>> _class="service", _style="font-weight: bold;", _href=URL('companies', args=
>> c.id), _id="res%s"%c.service_name, 
>> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name)))
>>
>> *VIEW*
>> *#This jQuery script attempts to display the hidden span*
>>
>> **$(document).ready(function(){
>> $('.service').click(function(e) {
>> const id = $(this).data('id'); 
>> $('#' + id).fadeIn(); 
>> e.preventDefault();
>>
>> });
>> });
>>
>> **
>>
>> Regards;
>>
>> Mostwanted
>>
>> -- 
>>
> 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+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/3b8a175c-ecdc-47e5-a157-45e7fe260f9fn%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/2db8f2a3-9c4d-44cf-b466-b70b84b761b4n%40googlegroups.com.


[web2py] Re: InFailedSqlTransaction

2020-11-10 Thread Gaël Princivalle
> Did you go in to the application so that db.py would be executed, thereby 
triggering the migration to happen? 
Yes, after each modification of the DB connection string I reload a website 
page.

I've resolved this problem moving the scheduler tables in another DB.

Thanks for your help.
Il giorno martedì 10 novembre 2020 alle 15:45:43 UTC+1 Jim S ha scritto:

> Did you go in to the application so that db.py would be executed, thereby 
> triggering the migration to happen?
>
> -Jim
>
> On Tuesday, November 10, 2020 at 8:33:41 AM UTC-6, Gaël Princivalle wrote:
>>
>> Thank you Jim.
>>
>> I've setted migrate to False and fake-migrate to True.
>> Deleted the scheduler tables in the database folder
>> Setted migrate to True and fake-migrate to False
>> And the tables are not rebuild in the DB.
>> The error still the same.
>>
>> I'll try to delete the scheduler.py file, export the db, import it in a 
>> new db and add again the scheduler...
>>
>> Il giorno martedì 10 novembre 2020 alle 15:20:36 UTC+1 Jim S ha scritto:
>>
>>> Can you go to the databases directory in your app and delete the 
>>> scheduler tables from there?  Then make sure your db connection has 
>>> migrate=True specified along with fake-migrate=False.
>>>
>>> I'm thinking that should force a rebuild of the scheduler tables in your 
>>> database.
>>>
>>> -Jim
>>>
>>>
>>> On Tuesday, November 10, 2020 at 3:02:15 AM UTC-6, Gaël Princivalle 
>>> wrote:

 I've deleted the scheduler.py file and deleted the scheduler tables.
 Now if I add again the scheduler.py file the scheduler tables are in 
 the admin but not in the DB, and the error is the same for all the 
 scheduler tables, InFailedSqlTransaction.

 Someone can help me?

 Il giorno domenica 8 novembre 2020 alle 21:08:45 UTC+1 Gaël Princivalle 
 ha scritto:

> We talk about the db.scheduler_task table. I've deleted all the 
> records from this table, and also from db.scheduler_run and 
> db.scheduler_worker.
>
> No way.
>
> Il giorno domenica 8 novembre 2020 alle 20:57:23 UTC+1 Gaël 
> Princivalle ha scritto:
>
>> Hi.
>>
>> Someone knows what it means?
>>
>> After a server change I'm able in the Admin to modify the table 
>> records but not the one of the scheduler.
>>
>> Any idea?
>>
>> Traceback (most recent call last):
>>   File "/home/user/apps/web2py_folder/web2py/gluon/main.py", line 
>> 456, in wsgibase
>> session._try_store_in_db(request, response)
>>   File "/home/user/apps/web2py_folder/web2py/gluon/globals.py", line 
>> 1251, in _try_store_in_db
>> if not table._db(table.id == record_id).update(**dd):
>>   File 
>> "/home/user/apps/web2py_folder/web2py/gluon/packages/dal/pydal/objects.py",
>>  
>> line 2686, in update
>> ret = db._adapter.update(table, self.query, row.op_values())
>>   File 
>> "/home/user/apps/web2py_folder/web2py/gluon/packages/dal/pydal/adapters/base.py",
>>  
>> line 579, in update
>> raise e
>> InFailedSqlTransaction: current transaction is aborted, commands 
>> ignored until end of transaction block
>>
>

-- 
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/a695a2a6-06a1-421d-b42e-6949ca33c84cn%40googlegroups.com.


[web2py] Re: Error: Connection lost during download

2020-11-10 Thread Clemens
If I had to guess, I'd say, that your web server is running in a timeout 
while downloading such a large file.

Best regards
Clemens

On Tuesday, November 10, 2020 at 6:41:35 PM UTC+1 SR wrote:

> Hi
> I store my uploaded file in the web2py "static" folder.
> One of the download link for linux binaries fails.  It downloads 1GB, then 
> fails.
> This is the link:
>
> https://cryoem.bcm.edu/cryoem/static/software/continuous_build/eman2_sphire_sparx_huge.linux.unstable.sh
> . 
> Is this problem due to the file is larger than 1GB? Could it be related to 
> one of the server settings?
> Could you help me figure out what is going on?
> Thank you very much in advance.
>
> Regards
> Sneka.
>

-- 
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/1462a7c9-9306-4fa9-9d81-b80421655bc1n%40googlegroups.com.


[web2py] Error: Connection lost during download

2020-11-10 Thread SR
Hi
I store my uploaded file in the web2py "static" folder.
One of the download link for linux binaries fails.  It downloads 1GB, then 
fails.
This is the link:
https://cryoem.bcm.edu/cryoem/static/software/continuous_build/eman2_sphire_sparx_huge.linux.unstable.sh
. 
Is this problem due to the file is larger than 1GB? Could it be related to 
one of the server settings?
Could you help me figure out what is going on?
Thank you very much in advance.

Regards
Sneka.

-- 
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/486ce844-7842-4c34-a762-9eb21e3291b1n%40googlegroups.com.


[web2py] Re: InFailedSqlTransaction

2020-11-10 Thread Jim S
Did you go in to the application so that db.py would be executed, thereby 
triggering the migration to happen?

-Jim

On Tuesday, November 10, 2020 at 8:33:41 AM UTC-6, Gaël Princivalle wrote:
>
> Thank you Jim.
>
> I've setted migrate to False and fake-migrate to True.
> Deleted the scheduler tables in the database folder
> Setted migrate to True and fake-migrate to False
> And the tables are not rebuild in the DB.
> The error still the same.
>
> I'll try to delete the scheduler.py file, export the db, import it in a 
> new db and add again the scheduler...
>
> Il giorno martedì 10 novembre 2020 alle 15:20:36 UTC+1 Jim S ha scritto:
>
>> Can you go to the databases directory in your app and delete the 
>> scheduler tables from there?  Then make sure your db connection has 
>> migrate=True specified along with fake-migrate=False.
>>
>> I'm thinking that should force a rebuild of the scheduler tables in your 
>> database.
>>
>> -Jim
>>
>>
>> On Tuesday, November 10, 2020 at 3:02:15 AM UTC-6, Gaël Princivalle wrote:
>>>
>>> I've deleted the scheduler.py file and deleted the scheduler tables.
>>> Now if I add again the scheduler.py file the scheduler tables are in the 
>>> admin but not in the DB, and the error is the same for all the scheduler 
>>> tables, InFailedSqlTransaction.
>>>
>>> Someone can help me?
>>>
>>> Il giorno domenica 8 novembre 2020 alle 21:08:45 UTC+1 Gaël Princivalle 
>>> ha scritto:
>>>
 We talk about the db.scheduler_task table. I've deleted all the records 
 from this table, and also from db.scheduler_run and db.scheduler_worker.

 No way.

 Il giorno domenica 8 novembre 2020 alle 20:57:23 UTC+1 Gaël Princivalle 
 ha scritto:

> Hi.
>
> Someone knows what it means?
>
> After a server change I'm able in the Admin to modify the table 
> records but not the one of the scheduler.
>
> Any idea?
>
> Traceback (most recent call last):
>   File "/home/user/apps/web2py_folder/web2py/gluon/main.py", line 456, 
> in wsgibase
> session._try_store_in_db(request, response)
>   File "/home/user/apps/web2py_folder/web2py/gluon/globals.py", line 
> 1251, in _try_store_in_db
> if not table._db(table.id == record_id).update(**dd):
>   File 
> "/home/user/apps/web2py_folder/web2py/gluon/packages/dal/pydal/objects.py",
>  
> line 2686, in update
> ret = db._adapter.update(table, self.query, row.op_values())
>   File 
> "/home/user/apps/web2py_folder/web2py/gluon/packages/dal/pydal/adapters/base.py",
>  
> line 579, in update
> raise e
> InFailedSqlTransaction: current transaction is aborted, commands 
> ignored until end of transaction block
>


-- 
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/42c29507-3077-40be-8e53-96b966ebd98co%40googlegroups.com.


[web2py] Re: InFailedSqlTransaction

2020-11-10 Thread Gaël Princivalle
Thank you Jim.

I've setted migrate to False and fake-migrate to True.
Deleted the scheduler tables in the database folder
Setted migrate to True and fake-migrate to False
And the tables are not rebuild in the DB.
The error still the same.

I'll try to delete the scheduler.py file, export the db, import it in a new 
db and add again the scheduler...

Il giorno martedì 10 novembre 2020 alle 15:20:36 UTC+1 Jim S ha scritto:

> Can you go to the databases directory in your app and delete the scheduler 
> tables from there?  Then make sure your db connection has migrate=True 
> specified along with fake-migrate=False.
>
> I'm thinking that should force a rebuild of the scheduler tables in your 
> database.
>
> -Jim
>
>
> On Tuesday, November 10, 2020 at 3:02:15 AM UTC-6, Gaël Princivalle wrote:
>>
>> I've deleted the scheduler.py file and deleted the scheduler tables.
>> Now if I add again the scheduler.py file the scheduler tables are in the 
>> admin but not in the DB, and the error is the same for all the scheduler 
>> tables, InFailedSqlTransaction.
>>
>> Someone can help me?
>>
>> Il giorno domenica 8 novembre 2020 alle 21:08:45 UTC+1 Gaël Princivalle 
>> ha scritto:
>>
>>> We talk about the db.scheduler_task table. I've deleted all the records 
>>> from this table, and also from db.scheduler_run and db.scheduler_worker.
>>>
>>> No way.
>>>
>>> Il giorno domenica 8 novembre 2020 alle 20:57:23 UTC+1 Gaël Princivalle 
>>> ha scritto:
>>>
 Hi.

 Someone knows what it means?

 After a server change I'm able in the Admin to modify the table records 
 but not the one of the scheduler.

 Any idea?

 Traceback (most recent call last):
   File "/home/user/apps/web2py_folder/web2py/gluon/main.py", line 456, 
 in wsgibase
 session._try_store_in_db(request, response)
   File "/home/user/apps/web2py_folder/web2py/gluon/globals.py", line 
 1251, in _try_store_in_db
 if not table._db(table.id == record_id).update(**dd):
   File 
 "/home/user/apps/web2py_folder/web2py/gluon/packages/dal/pydal/objects.py",
  
 line 2686, in update
 ret = db._adapter.update(table, self.query, row.op_values())
   File 
 "/home/user/apps/web2py_folder/web2py/gluon/packages/dal/pydal/adapters/base.py",
  
 line 579, in update
 raise e
 InFailedSqlTransaction: current transaction is aborted, commands 
 ignored until end of transaction block

>>>

-- 
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/1731a012-c710-4c1a-b133-ff2c1e8d04ban%40googlegroups.com.


[web2py] Re: InFailedSqlTransaction

2020-11-10 Thread Jim S
Can you go to the databases directory in your app and delete the scheduler 
tables from there?  Then make sure your db connection has migrate=True 
specified along with fake-migrate=False.

I'm thinking that should force a rebuild of the scheduler tables in your 
database.

-Jim

On Tuesday, November 10, 2020 at 3:02:15 AM UTC-6, Gaël Princivalle wrote:
>
> I've deleted the scheduler.py file and deleted the scheduler tables.
> Now if I add again the scheduler.py file the scheduler tables are in the 
> admin but not in the DB, and the error is the same for all the scheduler 
> tables, InFailedSqlTransaction.
>
> Someone can help me?
>
> Il giorno domenica 8 novembre 2020 alle 21:08:45 UTC+1 Gaël Princivalle ha 
> scritto:
>
>> We talk about the db.scheduler_task table. I've deleted all the records 
>> from this table, and also from db.scheduler_run and db.scheduler_worker.
>>
>> No way.
>>
>> Il giorno domenica 8 novembre 2020 alle 20:57:23 UTC+1 Gaël Princivalle 
>> ha scritto:
>>
>>> Hi.
>>>
>>> Someone knows what it means?
>>>
>>> After a server change I'm able in the Admin to modify the table records 
>>> but not the one of the scheduler.
>>>
>>> Any idea?
>>>
>>> Traceback (most recent call last):
>>>   File "/home/user/apps/web2py_folder/web2py/gluon/main.py", line 456, 
>>> in wsgibase
>>> session._try_store_in_db(request, response)
>>>   File "/home/user/apps/web2py_folder/web2py/gluon/globals.py", line 
>>> 1251, in _try_store_in_db
>>> if not table._db(table.id == record_id).update(**dd):
>>>   File 
>>> "/home/user/apps/web2py_folder/web2py/gluon/packages/dal/pydal/objects.py", 
>>> line 2686, in update
>>> ret = db._adapter.update(table, self.query, row.op_values())
>>>   File 
>>> "/home/user/apps/web2py_folder/web2py/gluon/packages/dal/pydal/adapters/base.py",
>>>  
>>> line 579, in update
>>> raise e
>>> InFailedSqlTransaction: current transaction is aborted, commands ignored 
>>> until end of transaction block
>>>
>>

-- 
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/0b4e4e73-2f2d-4ae5-95f6-c06867ff0440o%40googlegroups.com.


Re: [web2py] On Windows I am trying to delete an application that uses logging but the delete fails because the log file is "in use"

2020-11-10 Thread Davidiam
We found that by modifying the gluon\admin.py app_uninstall function, we 
could search for the open log file handles and close them before the actual 
delete of the files is performed. 

   import logging
   import logging.handlers

   for nm, lgr in logging.root.manager.loggerDict.items():
  if str(nm) == str(app):
 for h in lgr.handlers:
h.close()
On Tuesday, October 27, 2020 at 2:09:51 PM UTC+1 Davidiam wrote:

> It looks like it uses one handler although the logger rotates the actual 
> log files.  I think that I would need to shut down the logger before or at 
> the beginning of the uninstall step, but as the "uninstall application" is 
> run from the admin app, it would be a bit tricky to implement the shutdown 
> for a specific application in the admin application code.  If there was an 
> app.shutdown() method maybe
>
> For the moment I am first shutting down the application pool in IIS and 
> then deleting the app but I would prefer a coded solution.  We son't delete 
> applications aften, so the work-around is acceptable for the moment.
>
> On Tuesday, October 27, 2020 at 4:23:09 AM UTC+1 roge...@gmail.com wrote:
>
>> Ah, i see. Can you temporarily shutdown() the logger and then restart it 
>> when the uninstall is complete? Or does it need to stay running also? I 
>> think it is possible to close a specific handler as well - but i dont know 
>> how the logging works in web2py - maybe there is a single handler for all 
>> the apps (if you can't tell, i have never used it before :)
>>
>>
>> ___
>> *www.TenOutOfTen.org* 
>> roge...@gmail.com
>> (+95) 09 250018669 <+95%209%20250%20018%20669> (Myanmar)
>>
>>
>> On Mon, 26 Oct 2020 at 23:37, Davidiam  wrote:
>>
>>> Thank you for your reply,  
>>> Deleting the application folder gives the same error.  
>>> The problem is that the logger holds the log file locked.  If I restart 
>>> the webserver I can delete the file, but our developers can't restart web 
>>> services.
>>> It is not a big problem but I would like to find a solution (if one 
>>> exists)..
>>>
>>> On Monday, October 26, 2020 at 4:56:30 AM UTC+1 roge...@gmail.com wrote:
>>>
 Hi David

 I am not sure that i have ever used the Uninstall option. I just delete 
 the application folder and the application disappears. I am not sure if 
 that leaves any residual information in files somewhere. But i have not 
 noticed a problem.

 Does that work for you?
 Andrew

 ___
 *www.TenOutOfTen.org* 
 roge...@gmail.com
 (+95) 09 250018669 <+95%209%20250%20018%20669> (Myanmar)



 On Fri, 23 Oct 2020 at 17:07, Davidiam  wrote:

> When using logging in web2py on Windows, we are unable to delete 
> applications unless we first stop the server.
>
> The reason is that the app.log is considered "in use".
>
> As the uninstall happens from the admin app, I am not quite sure how 
> best to stop the logger in the application that is being uninstalled when 
> the "Uninstall" option is selected from admin.  
>
> Anyone have any ideas on how to unistall an app that uses logging.  
> Apparently this is only an issue on Windows because the os.unlink works 
> on 
> "in use" files on linux systems.
>
> Note : We have defined the location of the log files within the 
> application directory structure so that the developers have access to the 
> files.
>
> This is the logging code used :
> def get_configured_logger(name):
> Test = False
> logger = logging.getLogger(name)
> if (len(logger.handlers) == 0):
> # This logger has no handlers, so we can assume it hasn't yet been 
> configured
> # (Configure logger)
>
> # Create default handler
> if request.env.web2py_runtime_gae:
> # Create GAEHandler
> handler = GAEHandler()
> else:
> # Create RotatingFileHandler
> import os
> formatter="%(asctime)s %(levelname)s %(process)s %(thread)s 
> %(funcName)s():%   (lineno)d %(message)s"
> handler = 
> logging.handlers.RotatingFileHandler(os.path.join(request.folder,
> 'private/app.log'), maxBytes=100,backupCount=2)
> handler.setFormatter(logging.Formatter(formatter))
>
> handler.setLevel(logging.DEBUG)
>
> logger.addHandler(handler)
> logger.setLevel(logging.DEBUG)
>
> # Test entry:
>
> if Test == True:
> logger.debug(name + ' logger created')
> else:
> # Test entry:
> if Test == True:
> logger.debug(name + ' already exists')
>
> return logger
>
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> 

[web2py] How to generate SQL string without connecting to any database?

2020-11-10 Thread paulo....@gmail.com

Hi!

I was previously (web2py 2.18.5) using postgres:pg8000 adapter and a dummy 
connection string with the parameter do_connect=False in order to be able 
to generate  SQL query strings without actually connecting to any database.

I see that with the latest version (2.20.4) the "do_connect" was removed, 
and on post by Massimo on this group he says the connection will be delayed 
until it is really required. Unfortunately this doesn't seem to be 100% 
accurate, since either the DAL initialization or the _select method is 
triggering a connection to the database, requiring me to have a valid DB 
connection, even though I never actually send the query to the database.

Is there a way to get the SQL without requiring a valid DB connection? (I 
know its an odd setup, a portion on my "BD" is actually behind an web API 
and all I need is to push a SQL string. I can of course reuse the 
credentials for portion of data that sits on a standard SQL database, and 
open a connection to it just to generate SQL string, but I would like to 
avoid that if possible).

-- 
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/c4d373dd-021a-4ab7-985d-5000132b0e3cn%40googlegroups.com.


Re: [web2py] Scheduler on Opalstack

2020-11-10 Thread António Ramos
it worked for me.

Em ter., 10 de nov. de 2020 às 09:25, Gaël Princivalle <
gaelprinciva...@gmail.com> escreveu:

>
> Hello.
>
> Did someone tried to use the scheduler on Opalstack?
>
> I was used to run this command to start a worker in Webfaction but in
> Opalstack it don't works:
> nohup python web2py.py -K applicationname &
>
> I've tried in also in the virtualenv no way.
>
> Someone knows how I can do it?
>
> Thanks.
>
> --
> 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/58d806b1-48e1-473b-82d4-5e2aaa0c8002n%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/CAEM0BxO9vZkpqqy6KCKciLrGpUctPk79FRzum_f%3DN9ZxdUWUxw%40mail.gmail.com.


[web2py] Scheduler on Opalstack

2020-11-10 Thread Gaël Princivalle

Hello.

Did someone tried to use the scheduler on Opalstack?

I was used to run this command to start a worker in Webfaction but in 
Opalstack it don't works:
nohup python web2py.py -K applicationname & 

I've tried in also in the virtualenv no way.

Someone knows how I can do it?

Thanks.

-- 
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/58d806b1-48e1-473b-82d4-5e2aaa0c8002n%40googlegroups.com.


[web2py] Re: InFailedSqlTransaction

2020-11-10 Thread Gaël Princivalle
I've deleted the scheduler.py file and deleted the scheduler tables.
Now if I add again the scheduler.py file the scheduler tables are in the 
admin but not in the DB, and the error is the same for all the scheduler 
tables, InFailedSqlTransaction.

Someone can help me?

Il giorno domenica 8 novembre 2020 alle 21:08:45 UTC+1 Gaël Princivalle ha 
scritto:

> We talk about the db.scheduler_task table. I've deleted all the records 
> from this table, and also from db.scheduler_run and db.scheduler_worker.
>
> No way.
>
> Il giorno domenica 8 novembre 2020 alle 20:57:23 UTC+1 Gaël Princivalle ha 
> scritto:
>
>> Hi.
>>
>> Someone knows what it means?
>>
>> After a server change I'm able in the Admin to modify the table records 
>> but not the one of the scheduler.
>>
>> Any idea?
>>
>> Traceback (most recent call last):
>>   File "/home/user/apps/web2py_folder/web2py/gluon/main.py", line 456, in 
>> wsgibase
>> session._try_store_in_db(request, response)
>>   File "/home/user/apps/web2py_folder/web2py/gluon/globals.py", line 
>> 1251, in _try_store_in_db
>> if not table._db(table.id == record_id).update(**dd):
>>   File 
>> "/home/user/apps/web2py_folder/web2py/gluon/packages/dal/pydal/objects.py", 
>> line 2686, in update
>> ret = db._adapter.update(table, self.query, row.op_values())
>>   File 
>> "/home/user/apps/web2py_folder/web2py/gluon/packages/dal/pydal/adapters/base.py",
>>  
>> line 579, in update
>> raise e
>> InFailedSqlTransaction: current transaction is aborted, commands ignored 
>> until end of transaction block
>>
>

-- 
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/d107a783-6289-42bd-9f61-d5d9abace70fn%40googlegroups.com.