logging module and binary strings

2009-07-01 Thread Frank Aune
Hello, snip >>> import logging >>> logging.basicConfig(level=logging.DEBUG) >>> x='\xfe\x9f\xce\xc3\xa1\x00\xff\x01' >>> x '\xfe\x9f\xce\xc3\xa1\x00\xff\x01' >>> print x ���á� >>> logging.info(x) Traceback (most recent call last): File "/usr/lib/python2.6/logging/__init__.py", line 773

Python logging: Retrieving the last log record from a handler

2008-03-03 Thread Frank Aune
Hi, I'm using a log hierarchy in my application, and sometimes I find myself wanting to retrieve the latest log message written to the root logger. (Typical usage might be displaying the latest log message at all times in a GUI). The only way I've found how to solve this, is by adding a custom

MySQL and restore

2008-02-27 Thread Frank Aune
Hi, Inspired from http://blog.spikesource.com/mysql_hotbackup.htm: I restore a database from an SQL dump like this: (...) f= open('test.sql', 'r') sql = f.read() f.close() self.query("""%s""" % sql) (...) This works fine for dumps made with "mysqldump -uroot -B test > test.sql". However, if per

Re: Must COMMIT after SELECT (was: Very weird behavior in MySQLdb "execute")

2008-02-06 Thread Frank Aune
On Wednesday 06 February 2008 16:16:45 Paul Boddie wrote: > Really, the rule is this: always (where the circumstances described > above apply) make sure that you terminate a transaction before > attempting to read committed, updated data. How exactly do you terminate a transaction then?Do you term

Re: Must COMMIT after SELECT (was: Very weird behavior in MySQLdb "execute")

2008-02-06 Thread Frank Aune
On Tuesday 05 February 2008 18:58:49 John Nagle wrote: > So you really do have to COMMIT after a SELECT, if you are reusing > the database connection. CGI programs usually don't have this issue, > because their connections don't live long, but long-running FCGI (and maybe > Twisted) programs d

Re: MySQLdb: commit before cursor close, or after?

2008-02-04 Thread Frank Aune
On Monday 04 February 2008 19:14:13 John Nagle wrote: >I'm getting some wierd commit-related behavior from MySQLdb. I'm > using InnoDB, so transactions really matter. > > I'm currently doing > > cursor = db.cursor() > cursor.execute(...) > cursor.close() > db.commit() >

MySQLdb and DictCursor

2008-01-22 Thread Frank Aune
Hi, Im using a MySQLdb connection with a DictCursor, and to me it seems the wrapping to dictionaries only prepend column names when there is an actual conflict in the keywords. I would like the cursor to always prepend table names no matter what. Is this possible? Thanks, -Frank -- http://ma

Retrieving info from DBUS at application startup

2008-01-15 Thread Frank Aune
probing activity? Thanks, Frank Aune -- http://mail.python.org/mailman/listinfo/python-list

DBUS and exceptions

2008-01-14 Thread Frank Aune
Hi, Im using DBUS in my application to detect HW hotplugging and removal, which works great except for one thing: The code executed when a hotplugging is detected does not raise exceptions, even if my code contains errors. The event will just stop silently at the point where the exception occur

Re: Strange problem: MySQL and python logging using two separate cursors

2008-01-11 Thread Frank Aune
On Wednesday 09 January 2008 18:52:02 Dennis Lee Bieber wrote: > On Wed, 9 Jan 2008 10:11:09 +0100, Frank Aune <[EMAIL PROTECTED]> > > declaimed the following in comp.lang.python: > > The only clue I have so far, is that the cursor in task 1 seems to be > > unable to &q

Strange problem: MySQL and python logging using two separate cursors

2008-01-09 Thread Frank Aune
Hi, Explaining this problem is quite tricky, but please bear with me. Ive got an application which uses MySQL (InnoDB) for two things: 1. Store and retrieve application data (including viewing the application log) 2. Store the application log produced by the python logging module The connectio

PyPubSub module version 3 usage

2007-11-29 Thread Frank Aune
Hello, I just recently found out that wx.lib.pubsub has finally moved away from wx, and now lives at: http://pubsub.wiki.sourceforge.net I'm trying to use pubsub3, which is the third version and now the default one, but I'm having a hard time creating topics and messages for sending: class T

pyserial: loose connection after inactivity

2007-11-08 Thread Frank Aune
Hello, I configure the serial connection using: self.port = serial.Serial(baudrate=57600, timeout=0.06, parity=serial.PARITY_EVEN, stopbits=serial.STOPBITS_TWO,

Library package import question

2007-11-05 Thread Frank Aune
Hello, I have a python library package 'Foo', which contains alot of submodules: Foo/: __init__.py module1.py: class Bar() class Hmm() module2.py class Bee() class Wax() module3.py etc

Re: Fwd: Namespace question

2007-10-31 Thread Frank Aune
On Wednesday 31 October 2007 15:19:25 Andrii V. Mishkovskyi wrote: > You mean something like this: > >>>import random > >>>def foo(): > > ...print '42' > > >>>random.randit = foo > >>>random.randit() > > 42 > > am I right? > -- I was thinking more of the line: random.py: (my custom random.py

Namespace question

2007-10-31 Thread Frank Aune
Hello, Is it possible writing custom modules named the same as modules in the standard library, which in turn use the same module from the standard library? Say I want my application to have a random.py module, which in turn must import the standard library random.py module also, to get hold o

Re: python logging module and custom handler specified in config file

2007-10-19 Thread Frank Aune
On Thursday 18 October 2007 19:26:59 Vinay Sajip wrote: > The values in the config file are interpreted in the context of the > logging module's namespace. Hence, one way of achieving what you want > is putting any custom handlers in > a module of your own, and providing a binding in the logging mo

Re: ConfigParser preserving file ordering

2007-10-19 Thread Frank Aune
On Friday 19 October 2007 03:42:16 Joshua J. Kugler wrote: > > Have you taken a look at ConfigObj? > > http://www.voidspace.org.uk/python/configobj.html > Yes, but as I said I need functionality present in the standard-library, so sub-classing ConfigParser is the last option really. I was hoping

ConfigParser preserving file ordering

2007-10-18 Thread Frank Aune
Hello, I use ConfigParser and actually quite like it, EXCEPT that it doesnt preserve the section order of the original config file when writing a new. This behaviour is hopeless IMO, and I've been looking for alternatives. I've been reading the interesting discussion on python-dev about improve

Re: python logging module and custom handler specified in config file

2007-10-18 Thread Frank Aune
On Thursday 18 October 2007 19:26:59 Vinay Sajip wrote: > The same technique applies to the arguments passed to the constructor. > > Hope this helps, > Thank you! This seems like exactly what I was looking for. Very impressive logging framework btw - I use it whenever I can =) Cheers, Frank --

python logging module and custom handler specified in config file

2007-10-15 Thread Frank Aune
er' is not defined. Is this possible to archieve somehow? Best regards, Frank Aune -- http://mail.python.org/mailman/listinfo/python-list

Python submodules and name imports

2007-08-23 Thread Frank Aune
_.py? I'm looking for the "official" way of doing this. Thank you, Frank Aune -- http://mail.python.org/mailman/listinfo/python-list