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 a écrit :
> Hello
>
> I've just realized recently that sy
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',
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 a écrit :
> Le 17/11/201
0"}, {"name": "disk2", "size": "647648"}]
> >>> disk_list2 = simplejson.loads(disk_list_json)
> >>> print disk_list2
> [{u'name': u'disk1', u'size': u'52428800'}, {u'name': u
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 SyslogHand
# 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 = dateti
Because "is" operator take precedence on ">" operator .
Le Wed, 15 Sep 2010 05:34:06 -0700 (PDT),
Yingjie Lan a écrit :
> Hi,
>
> I am not sure how to interprete this, in the interactive mode:
>
> >>> 3>0 is True
> False
> >>> (3>0) is True
> True
> >>> 3> (0 is True)
> True
>
> Why did I ge
ressions.html#comparisons
So for :
>>> 3 > 0 is True
#first evaluation is :
>>> 3 > 0 ---> 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 Ricor
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 a écrit :
> I'm writing a simple simulator, and I want to schedule an action to
> occ