Re: [rotatingloghandler]: How to read the logs produced ?

2011-01-19 Thread Michael Ricordeau
I suggest SyslogHandler in logging package to centralize all logs . http://docs.python.org/library/logging.html#sysloghandler In my opinion, rotating, parsing, filtering logs is a different task (for a sysadmin not a developper). I'm doing this for all my projects at work : - using

Re: Pickle in a POST/GET request give EOFError

2010-11-18 Thread Michael Ricordeau
Hi, you can use json for passing list and dict . Pickle is dangerous . Instead of pickle.loads/pickle.dumps use json.loads and json.dumps (using stdlib json in python = 2.6 or simplejson in python 2.6) Regards Le Thu, 18 Nov 2010 09:29:00 +0100, Romaric DEFAUX r...@audaxis.com a écrit :

Re: Pickle in a POST/GET request give EOFError

2010-11-18 Thread Michael Ricordeau
: 647648}]' Explanation : I dumps with json a list of dictionnaries into disk_list_json. When I loads it, I don't get my list of dictionnaries like before (see disk_list2). It adds u letter everywhere. Why ? Thanks for help ! Romaric Defaux Le 18/11/2010 09:43, Michael Ricordeau

Re: Deferring a function call

2010-10-19 Thread Michael Ricordeau
For scheduling, I use eventlet package and spawn_after_local . http://eventlet.net But you must be aware of the constraints like using monkey patched modules . Le Mon, 18 Oct 2010 21:21:41 -0700, TomF tomf.sess...@gmail.com a écrit : I'm writing a simple simulator, and I want to schedule

Re: 30 is True

2010-09-15 Thread Michael Ricordeau
Because is operator take precedence on operator . Le Wed, 15 Sep 2010 05:34:06 -0700 (PDT), Yingjie Lan lany...@yahoo.com a écrit : Hi, I am not sure how to interprete this, in the interactive mode: 30 is True False (30) is True True 3 (0 is True) True Why did I get the first

Re: 30 is True

2010-09-15 Thread Michael Ricordeau
--- True #second evaluation is : 0 is True --- False (and second evaluation is not result of first one !) Le Wed, 15 Sep 2010 14:47:11 +0200, Michael Ricordeau michael.ricord...@gmail.com a écrit : Because is operator take precedence on operator . Le Wed, 15 Sep 2010 05:34:06 -0700

Re: python datetime

2010-09-14 Thread Michael Ricordeau
# Determine diff days between two dates import datetime now = datetime.date(2010, 9, 28) next = datetime.date(2010, 10, 5) delta = next - now #delta is datetime.timedelta type. #(You can extract days diff) # Determine date in 7 days import datetime now = datetime.date(2010, 9, 28) delta =

Re: psycopg2 / psycopg2.DataError: invalid input syntax for type timestamp with time zone:

2010-03-31 Thread Michael Ricordeau
Hi You cannot add 'NOW() - '29 days'::INTERVAL' as a query because cursor.execute() will try to mogrify it. You can do : import datetime idays = psycopg2.extensions.adapt(datetime.timedelta(days=29)) self.dyndb.orderdb.query('update set creation_date=(NOW() - %s) where id_order=%s',

Re: Castrated traceback in sys.exc_info()

2010-03-17 Thread Michael Ricordeau
Hi, to log tracebacks, you can probably try traceback module. I use it like this : import traceback # your code for line in traceback.format_exc().splitlines(): log.trace(line) Le Wed, 17 Mar 2010 03:42:44 -0700 (PDT), Pakal chambon.pas...@gmail.com a écrit : Hello I've just