Problem with regular expression

2010-03-07 Thread Joan Miller
I would to convert the first string to upper case. But this regular expression is not matching the first string between quotes. re.sub("'(?P\w+)': [^{]", "\gFOO", str) # string to non-matching 'foo': { # strings to matching 'bar': 'bar2' 'bar': None 'bar': 0 'bar': True So, i.e., from the fir

Escape curly bracket together to a variable extension

2010-03-06 Thread Joan Miller
How to escape the first '}' in the next string? s = "}\n{0}".format('foo') -- http://mail.python.org/mailman/listinfo/python-list

Slicing [N::-1]

2010-03-05 Thread Joan Miller
What does a slice as [N::-1] ? It looks that in the first it reverses the slice and then it shows only N items, right? Could you add an example to get the same result without use `::` to see it more clear? Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list

Re: Get dosctring without import

2010-02-26 Thread Joan Miller
On 26 feb, 12:35, Ben Finney wrote: > Joan Miller writes: > > I use a function in 'setupy.py' to get automatically the description > > from the package's docstring, but there is a problem when you import a > > module that has to be built by cython (because it

Re: Get dosctring without import

2010-02-26 Thread Joan Miller
On 26 feb, 10:57, Peter Otten <__pete...@web.de> wrote: > Joan Miller wrote: > > When a package is imported, it gets the dosctring to store it in > > *__doc__*. > > > Does that funcion is built in python? because I would want use it to > > get the docstring wi

Re: Get dosctring without import

2010-02-26 Thread Joan Miller
On 26 feb, 10:51, Ben Finney wrote: > Joan Miller writes: > > When a package is imported, it gets the dosctring to store it in > > *__doc__*. > > Joan, in this message and numerous others you've been following the > widespread convention of using asterisks ‘*’ t

Get dosctring without import

2010-02-26 Thread Joan Miller
When a package is imported, it gets the dosctring to store it in *__doc__*. Does that funcion is built in python? because I would want use it to get the docstring without import a package -- http://mail.python.org/mailman/listinfo/python-list

Re: Fascism is coming to Internet

2010-02-24 Thread Joan Miller
On 23 feb, 20:16, "D'Arcy J.M. Cain" wrote: > On Tue, 23 Feb 2010 20:30:03 +0100 > > Olof Bjarnason wrote: > > Even if this is "Off Topic" (which I think it really isn't in any open > > source / free software-oriented mailing list), I want to agree with > > Joan. > > It isn't about the Python pro

Re: Fascism is coming to Internet

2010-02-23 Thread Joan Miller
On 23 feb, 10:54, Joan Miller wrote: > *Sorry by this message off topic, but this is too important* > > Fascism is coming fastly to Internet because is the only communication > way that governements (managed by the bank and multinationals) cann't > control > > http://www

Fascism is coming to Internet

2010-02-23 Thread Joan Miller
*Sorry by this message off topic, but this is too important* Fascism is coming fastly to Internet because is the only communication way that governements (managed by the bank and multinationals) cann't control http://www.boingboing.net/2010/02/21/acta-internet-enforc.html -- http://mail.python.o

Re: Union of class variables [Solved]

2010-02-16 Thread Joan Miller
On 16 feb, 08:40, alex23 wrote: > On Feb 16, 6:16 pm, Joan Miller wrote: > > > Is possible to get a third class with the class variables of another > > two classes? > > > > > class A: > >     foo = 1 > > > class B: > >    

Re: Printing with raw_input

2010-02-15 Thread Joan Miller
On 15 feb, 10:11, Peter Otten <__pete...@web.de> wrote: > Joan Miller wrote: > > Does `raw_input` uses internally `sys.stdout.write`? > > You can test this yourself without reading the C source: > > Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55) > [GCC 4.4.1] on li

Printing with raw_input

2010-02-15 Thread Joan Miller
Does `raw_input` uses internally `sys.stdout.write`? -- http://mail.python.org/mailman/listinfo/python-list

Re: Simulating logging.exception with another traceback

2010-02-09 Thread Joan Miller
On 8 feb, 21:13, Vinay Sajip wrote: > On Feb 7, 11:22 am, Joan Miller wrote: > > > > > I would want to get the output from `logging.exception` but with > > traceback from the caller function (I've already all that > > information). > > > T

Simulating logging.exception with another traceback

2010-02-07 Thread Joan Miller
I would want to get the output from `logging.exception` but with traceback from the caller function (I've already all that information). This would be the error with logging.exception: ERROR: PipeError('/bin/ls -l | ', 'no command after of pipe') Traceback (most recent call

Re: simple and fast platform independent IPC

2010-02-03 Thread Joan Miller
On 3 feb, 10:54, Tim Golden wrote: > [News123] > > >>> I wondered what IPC library might be best simplest for following task? > > ... > > >>> xmlrpc seems to be a little heavy for such tasks. > > >>> signals don't allow to exchange data > > >>> a shared memory message queue would probably a good s

Re: simple and fast platform independent IPC

2010-02-03 Thread Joan Miller
On 3 feb, 09:34, Vinay Sajip wrote: > On Feb 3, 8:32 am, News123 wrote: > > > > > Hi, > > > I wondered what IPC library might be best simplest for following task? > > > I'm having a few python scripts all running on the same host (linux or > > win), which are started manually in random order. (no

Re: No return to the parent function

2010-02-02 Thread Joan Miller
On 2 feb, 16:55, Arnaud Delobelle wrote: > Joan Miller writes: > > I've a main function called i.e. *foo()* which has a block of code > > that is repetead several times (for the error catching code and error > > reporting), but that code has a return to exit of *foo()*

No return to the parent function

2010-02-02 Thread Joan Miller
I've a main function called i.e. *foo()* which has a block of code that is repetead several times (for the error catching code and error reporting), but that code has a return to exit of *foo()* --- foo(): ... if self.background: _log.exception(str(error)) return Retu

Re: User-defined exceptions from 2.6

2010-02-01 Thread Joan Miller
On 1 feb, 12:45, Steven D'Aprano wrote: > On Mon, 01 Feb 2010 02:19:39 -0800, Joan Miller wrote: > > Which is the best way to create user-defined exceptions since that > > *BaseException.message* is deprecated in Python 2.6 ? > > Inherit from an existing exception. >

User-defined exceptions from 2.6

2010-02-01 Thread Joan Miller
Which is the best way to create user-defined exceptions since that *BaseException.message* is deprecated in Python 2.6 ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Wrap a function

2010-01-29 Thread Joan Miller
On 29 ene, 05:44, Dennis Lee Bieber wrote: > On Thu, 28 Jan 2010 11:24:28 -0800 (PST), Joan Miller > declaimed the following in > gmane.comp.python.general: > > > On 28 ene, 19:16, Josh Holland wrote: > > > On 2010-01-28, Joan Miller wrote: > > > > &g

Re: Wrap a function

2010-01-29 Thread Joan Miller
On 28 ene, 22:57, John Posner wrote: > On 1/28/2010 3:45 PM, Joan Miller wrote: > > > > > On 28 ene, 20:34, Joan Miller  wrote: > >> On 28 ene, 20:20, Peter  wrote: > > >>> On Jan 29, 6:58 am, John Posner  wrote: > > >>>> On 1/28/2010

Re: Wrap a function

2010-01-29 Thread Joan Miller
On 28 ene, 23:36, Jonathan Gardner wrote: > On Jan 28, 2:16 pm, Joan Miller wrote: > > > > > There would be to make a function for each system command to use so it > > would be too inefficient, and follow the problem with the quotes. > > > The best is make

Re: Wrap a function

2010-01-28 Thread Joan Miller
On 28 ene, 21:40, Jonathan Gardner wrote: > On Jan 28, 10:20 am, Joan Miller wrote: > > > > > I've to call to many functions with the format: > > > >>> run("cmd") > > > were "cmd" is a command with its arguments to pa

Re: Wrap a function

2010-01-28 Thread Joan Miller
On 28 ene, 20:34, Joan Miller wrote: > On 28 ene, 20:20, Peter wrote: > > > On Jan 29, 6:58 am, John Posner wrote: > > > > On 1/28/2010 2:24 PM, Joan Miller wrote: > > > > > On 28 ene, 19:16, Josh Holland  wrote: > > > >> On 2010-01-28

Re: Wrap a function

2010-01-28 Thread Joan Miller
On 28 ene, 20:20, Peter wrote: > On Jan 29, 6:58 am, John Posner wrote: > > > > > On 1/28/2010 2:24 PM, Joan Miller wrote: > > > > On 28 ene, 19:16, Josh Holland  wrote: > > >> On 2010-01-28, Joan Miller  wrote: > > > >>> I've

Re: Wrap a function

2010-01-28 Thread Joan Miller
On 28 ene, 19:58, John Posner wrote: > On 1/28/2010 2:24 PM, Joan Miller wrote: > > > On 28 ene, 19:16, Josh Holland  wrote: > >> On 2010-01-28, Joan Miller  wrote: > > >>> I've to call to many functions with the format: > > >>>>>>

Re: Wrap a function

2010-01-28 Thread Joan Miller
On 28 ene, 19:54, Steve Holden wrote: > Joan Miller wrote: > > On 28 ene, 19:16, Josh Holland wrote: > >> On 2010-01-28, Joan Miller wrote: > > >>> I've to call to many functions with the format: > >>>>>> run("cmd")

Re: Great example of a python module/package following up to date conventions.

2010-01-28 Thread Joan Miller
On 28 ene, 19:17, Big Stu wrote: > I'm hoping someone on here can point me to an example of a python > package that is a great example of how to put it all together.  I'm > hoping for example code that demonstrates: > > -Strict adherence to PEP 8 > -thorough use of Docstrings > -Conventional direc

Re: Wrap a function

2010-01-28 Thread Joan Miller
On 28 ene, 19:16, Josh Holland wrote: > On 2010-01-28, Joan Miller wrote: > > > I've to call to many functions with the format: > > >>>> run("cmd") > > Check the docs on os.system(). No. I've a function that uses subprocess to run commands

Wrap a function

2010-01-28 Thread Joan Miller
I've to call to many functions with the format: >>> run("cmd") were "cmd" is a command with its arguments to pass them to the shell and run it, i.e. >>> run("pwd") or >>> run("ls /home") Does anybody knows any library to help me to avoid the use of the main quotes, and brackets? I would to us

Re: ISC License

2010-01-24 Thread Joan Miller
On 23 ene, 18:45, a...@pythoncraft.com (Aahz) wrote: > In article > <00eb248d-c9c9-430f-bc83-41ac865c5...@e11g2000yqe.googlegroups.com>, > Joan Miller   wrote: > > > > >There is a license approved by the OSI, the ISC License [1], which > >should be included

ISC License

2010-01-23 Thread Joan Miller
There is a license approved by the OSI, the ISC License [1], which should be included in the PyPi classifiers [2]. [1] https://www.isc.org/software/license http://www.opensource.org/licenses/isc-license.txt [2] http://pypi.python.org/pypi?%3Aaction=list_classifiers -- http://mail.python.org/mail

Milliseconds in logging format

2010-01-10 Thread Joan Miller
How the logging '%(asctime)s' [1] specifier to gets the millisecond portion of the time if there is not a directive to get it from the time module [2] ? "The date format string follows the requirements of strftime()" [1] http://docs.python.org/library/logging.html#basic-example [2] http://docs.p

Re: Prepend to logging message

2010-01-10 Thread Joan Miller
On 10 ene, 13:10, Joan Miller wrote: > On 10 ene, 12:36, Peter Otten <__pete...@web.de> wrote: > > > > > Joan Miller wrote: > > > On 10 ene, 10:26, Peter Otten <__pete...@web.de> wrote: > > >> Joan Miller wrote: > > >> >

Re: Prepend to logging message

2010-01-10 Thread Joan Miller
On 10 ene, 12:36, Peter Otten <__pete...@web.de> wrote: > Joan Miller wrote: > > On 10 ene, 10:26, Peter Otten <__pete...@web.de> wrote: > >> Joan Miller wrote: > >> > How to prepend anything to a logging message? Is possible to do it > >> >

Re: Prepend to logging message

2010-01-10 Thread Joan Miller
On 10 ene, 10:26, Peter Otten <__pete...@web.de> wrote: > Joan Miller wrote: > > How to prepend anything to a logging message? Is possible to do it > > from the dictionary object (ExtraLog) or is there is that override > > process() [1]? > > >

Re: Prepend to logging message

2010-01-10 Thread Joan Miller
On 10 ene, 03:27, Ishwor Gurung wrote: > Joan, > > 2010/1/10 Joan Miller : > > > > > How to prepend anything to a logging message? Is possible to do it > > from the dictionary object (ExtraLog) or is there is that override > > process() [1]? > > >

Prepend to logging message

2010-01-09 Thread Joan Miller
How to prepend anything to a logging message? Is possible to do it from the dictionary object (ExtraLog) or is there is that override process() [1]? -- class ExtraLog(object): def __getitem__(self, name): if name == 'foo': result = 'testing' return

Set variables based on dictionary

2010-01-04 Thread Joan Miller
How to set local variables based on dictionary contents? -- http://mail.python.org/mailman/listinfo/python-list

Re: Extra fields for logging

2009-12-26 Thread Joan Miller
On 26 dic, 04:34, Steven D'Aprano wrote: > On Fri, 25 Dec 2009 12:07:20 -0800, Joan Miller wrote: > > On 25 dic, 13:24, Steven D'Aprano > cybersource.com.au> wrote: > >> On Thu, 24 Dec 2009 05:06:48 -0800, Joan Miller wrote: > >> > I'm trying

Re: Extra fields for logging

2009-12-25 Thread Joan Miller
On 25 dic, 13:24, Steven D'Aprano wrote: > On Thu, 24 Dec 2009 05:06:48 -0800, Joan Miller wrote: > > I'm trying to add some extra fields to logging, I'm following this > > information [1] but it faills in my case. > [...] > > I get => KeyError: 'hos

Extra fields for logging

2009-12-24 Thread Joan Miller
I'm trying to add some extra fields to logging, I'm following this information [1] but it faills in my case. # module logger.py import logging class ExtraInfo(object): def __getitem__(self, name): if name == 'host': result = 'foo' def __iter__(self