Re: strptime format string nasty default

2012-05-09 Thread Garrett Cooper
On May 9, 2012, at 12:38 PM, "Javier Novoa C." wrote: > Hi, > > I am using time.strptime method as follows: > > I receive an input string, representing some date in the following > format: > > %d%m%Y > > However, the day part may be a single digit or two, depending on > magnitude. > > For e

Re: Lack of whitespace between contain operator ("in") and other expression tokens doesn't result in SyntaxError: bug or feature?

2012-05-03 Thread Garrett Cooper
On Thu, May 3, 2012 at 12:03 PM, Ian Kelly wrote: > On Thu, May 3, 2012 at 12:49 PM, Garrett Cooper wrote: >>    I was wondering whether this was a parser bug or feature (seems >> like a bug, in particular because it implicitly encourages bad syntax, >> but I could be wron

Lack of whitespace between contain operator ("in") and other expression tokens doesn't result in SyntaxError: bug or feature?

2012-05-03 Thread Garrett Cooper
Hi Python folks! I came across a piece of code kicking around a sourcebase that does something similar to the following: >>> START #!/usr/bin/env python import sys def foo(): bar = 'abcdefg' foo = [ 'a' ] # Should throw SyntaxError? for foo[0]in bar: sys.stdout.

Re: Cross-compiling error when compiling 2.6.1...

2009-02-24 Thread Garrett Cooper
On Tue, Feb 24, 2009 at 12:55 PM, Garrett Cooper wrote: > I come across the following error: > > checking for chflags... configure: error: cannot run test program > while cross compiling > See `config.log' for more details. > make-3.81[1]: *** > [/nobackup/garrcoop/pyt

Cross-compiling error when compiling 2.6.1...

2009-02-24 Thread Garrett Cooper
I come across the following error: checking for chflags... configure: error: cannot run test program while cross compiling See `config.log' for more details. make-3.81[1]: *** [/nobackup/garrcoop/python_upgrade/contrib/python/obj-mips32/Makefile] Error 1 make-3.81[1]: Leaving directory `/nobackup/

Re: Problem trying to install ReportLab with easy_install

2009-02-22 Thread Garrett Cooper
On Sat, Feb 21, 2009 at 10:06 PM, Sebastian Bassi wrote: > I don't understand what is wrong when I try to install ReportLab. This > is under Ubuntu and all build packages are installed. > Here is what I get when trying to install it: (I could install it with > apt-get, but I am testing virtualenv

Re: logging and daemons

2009-02-16 Thread Garrett Cooper
On Mon, Feb 16, 2009 at 5:15 AM, Fernando M. Maresca wrote: > Hello, thanks for the answer. > > On Mon, Feb 16, 2009 at 05:07:45AM -0800, Garrett Cooper wrote: >> You can actually set sys.std[err|out] to your ?file? descriptor of >> choice in python (it has to have read, wri

Re: logging and daemons

2009-02-16 Thread Garrett Cooper
On Mon, Feb 16, 2009 at 5:02 AM, Fernando M. Maresca wrote: > > Hello. > > I'm in the process of replacing a custom logger class in one of my apps > that has several daemons. In the last step of daemonizing a program, > after closing fds, stderr and stdout are redirected to the logfile of > the pr

Creating custom formatter function

2009-02-16 Thread Garrett Cooper
Hello Python folks, I have a function where I'd like to prefix a format string via a `prefix' string. The definition of the base method is as follows: #START CODE def print_message(prefix, out_stream, fmt, *args, **kwargs): """ Print out [prefix]: [message] """ message = fmt if 0