Re: Reading Live Output from a Subprocess

2012-04-06 Thread Nobody
On Fri, 06 Apr 2012 12:21:51 -0700, Dubslow wrote: > It's just a short test script written in python, so I have no idea how > to even control the buffering In Python, you can set the buffering when opening a file via the third argument to the open() function, but you can't change a stream's buffe

Re: Reading Live Output from a Subprocess

2012-04-06 Thread Frank Millman
"Dubslow" wrote: > It's just a short test script written in python, so I have no idea how to > even control the buffering (and even if I did, I still can't modify the > subprocess I need to use in my script). What confuses me then is why Perl > is able to get around this just fine without fak

Re: escaping/encoding/formatting in python

2012-04-06 Thread Nobody
On Fri, 06 Apr 2012 06:22:13 -0700, rusi wrote: > But are not such cases rare? They exist, therefore they have to be supported somehow. > For example code such as: > print '"' > print str(something) > print '"' > > could better be written as > print '"%s"' % str(something) Not if the text betw

Re: Reading Live Output from a Subprocess

2012-04-06 Thread John O'Hagan
On Fri, 6 Apr 2012 12:21:51 -0700 (PDT) Dubslow wrote: > On Friday, April 6, 2012 3:37:10 AM UTC-5, Nobody wrote: > > > In all probability, this is because the child process (pypy) is > > buffering its stdout, meaning that the data doesn't get passed to the OS > > until either the buffer is full

Re: Cannot connect to IMAP server in Python 3.2

2012-04-06 Thread Keith Medcalf
Steve Howell wrote in news:ae774035-9db0-469d-aa2a- 02f2d25ff...@qg3g2000pbc.googlegroups.com: > Once you are able to import ssl, you should be able to use IMAP4_SSL, > but that still doesn't entirely explain to me why you got a timeout > error with plain IMAP4 and the proper port. (I would have

Re: xlrd 0.7.6 released!

2012-04-06 Thread Karim
Le 07/04/2012 04:07, Keith Medcalf a écrit : Karim wrote in news:mailman.1309.1333529851.3037.python-l...@python.org: This release manage the '.xlsx' format? http://packages.python.org/openpyxl/ Ah Keith, I just check this is only for xlsx format so I will make 2 code branches so I don't

Re: Generating custom Windows installers

2012-04-06 Thread Mark Hammond
On 7/04/2012 12:57 AM, Cesar Covarrubias wrote: I'm still getting my feet wet on the Windows side of things with Python, so I apologize for the noobish question. If i am reading the create_link.py example correctly, that is created when the application itself is invoked, not during installation.

Re: xlrd 0.7.6 released!

2012-04-06 Thread Keith Medcalf
Karim wrote in news:mailman.1309.1333529851.3037.python-l...@python.org: > This release manage the '.xlsx' format? http://packages.python.org/openpyxl/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Gotcha's?

2012-04-06 Thread Barry W Brown
On Thursday, April 5, 2012 11:28:01 PM UTC-5, rusi wrote: > On Apr 5, 4:06 pm, Duncan Booth wrote: > > Steven D'Aprano wrote: > > > JSON expects double-quote marks, not single: > > >     v = json.loads("{'test':'test'}")  fails > > >     v = json.loads('{"test":"test"}')  succeeds > > > > You mea

Re: Learning new APIs/classes (beginner question)

2012-04-06 Thread Steven D'Aprano
On Fri, 06 Apr 2012 13:41:23 -0700, Martin Jones wrote: > In a nutshell: My question is: how do experienced coders learn about > external/third-party classes/APIs? Does it have a tutorial? Do it. Does it have a manual, a wiki, FAQs, or other documentation? Read them. If all else fails, what doe

Re: 'string_escape' in python 3

2012-04-06 Thread Ian Kelly
On Fri, Apr 6, 2012 at 11:52 AM, Nicholas Cole wrote: > In Python 2 given the following raw string: > s = r"Hello\x3a this is a test" > > the escaping could be removed by use of the following: > s.decode('string_escape') > > In Python 3, however, the only way I can see to achieve the sam

Re: 'string_escape' in python 3

2012-04-06 Thread Ian Kelly
On Fri, Apr 6, 2012 at 4:19 PM, Terry Reedy wrote: > I actually thought of that, but assumed that adding enclosing quotes would > be safe (or that the OP trusted the string). After sending, I realized that > if Nasty Hacker guessed that the string would be so augmented, then it would > not be safe

Re: numpy.genfromtxt with Python3 - howto

2012-04-06 Thread Marc Christiansen
Helmut Jarausch wrote: > I have a machine with a non-UTF8 local. > I can't figure out how to make numpy.genfromtxt work [...] > #!/usr/bin/python3 > import numpy as np > import io > import sys > > inpstream = io.open(sys.stdin.fileno(), "r", encoding='latin1') > > data = np.genfromtxt(inpstream)

Re: 'string_escape' in python 3

2012-04-06 Thread Terry Reedy
On 4/6/2012 6:05 PM, Cameron Simpson wrote: On 06Apr2012 16:57, Terry Reedy wrote: | On 4/6/2012 1:52 PM, Nicholas Cole wrote: | bytes(s, 'utf-8').decode('unicode_escape') |> |> This seems very ugly (and slightly 'wrong'). Is there no way to do |> this without using bytes? Have I mis

Re: 'string_escape' in python 3

2012-04-06 Thread Cameron Simpson
On 06Apr2012 16:57, Terry Reedy wrote: | On 4/6/2012 1:52 PM, Nicholas Cole wrote: | > In Python 2 given the following raw string: | > | s = r"Hello\x3a this is a test" | > | > the escaping could be removed by use of the following: | > | s.decode('string_escape') | | > In Python 3, howe

Re: Learning new APIs/classes (beginner question)

2012-04-06 Thread Emile van Sebille
On 4/6/2012 1:41 PM Martin Jones said... In a nutshell: My question is: how do experienced coders learn about external/third-party classes/APIs? I'm teaching myself Python through a combination of Hetland's 'Beginning Python', various online tutorials and some past experience coding ASP/VBScript

Learning new APIs/classes (beginner question)

2012-04-06 Thread Martin Jones
In a nutshell: My question is: how do experienced coders learn about external/third-party classes/APIs? I'm teaching myself Python through a combination of Hetland's 'Beginning Python', various online tutorials and some past experience coding ASP/VBScript. To start to learn Python I've set myself

Re: 'string_escape' in python 3

2012-04-06 Thread Terry Reedy
On 4/6/2012 1:52 PM, Nicholas Cole wrote: In Python 2 given the following raw string: s = r"Hello\x3a this is a test" the escaping could be removed by use of the following: s.decode('string_escape') In Python 3, however, the only way I can see to achieve the same result is to convert int

Possible change to logging.handlers.SysLogHandler

2012-04-06 Thread Vinay Sajip
There is a problem with the way logging.handlers.SysLogHandler works when presented with Unicode messages. According to RFC 5424, Unicode is supposed to be sent encoded as UTF-8 and preceded by a BOM. However, the current handler implementation puts the BOM at the start of the formatted message, an

Re: Reading Live Output from a Subprocess

2012-04-06 Thread Vinay Sajip
On Apr 6, 7:57 am, buns...@gmail.com wrote: > I've heard that the Pexpect module works wonders, but the problem is that > relies on pty which is available in Unix only. Additionally, because I want > this script to be usable by others, any solution should be in the standard > library, which mea

Re: Reading Live Output from a Subprocess

2012-04-06 Thread Dubslow
On Friday, April 6, 2012 3:37:10 AM UTC-5, Nobody wrote: > In all probability, this is because the child process (pypy) is > buffering its stdout, meaning that the data doesn't get passed to the OS > until either the buffer is full or the process terminates. If it doesn't > get passed to the OS, t

Re: Reading Live Output from a Subprocess

2012-04-06 Thread shi
Maybe this can help you? http://technogems.blogspot.com/2012/01/capture-colored-console-output-in.html -- http://mail.python.org/mailman/listinfo/python-list

'string_escape' in python 3

2012-04-06 Thread Nicholas Cole
In Python 2 given the following raw string: >>> s = r"Hello\x3a this is a test" the escaping could be removed by use of the following: >>> s.decode('string_escape') In Python 3, however, the only way I can see to achieve the same result is to convert into a byte stream and then back: >>> bytes

Re: Async IO Server with Blocking DB

2012-04-06 Thread Laszlo Nagy
There is asyncmongo! http://pypi.python.org/pypi/asyncmongo/0.1.3 Although I have never tried it. It has support for async I/O for mongodb and tornadoweb. Here is a bit old article about it: http://www.dunnington.net/entry/asynchronous-mongodb-in-tornado-with-asyncmongo I have a related ques

Re: Async IO Server with Blocking DB

2012-04-06 Thread Damjan Georgievski
> We are thinking about building a webservice server and considering > python event-driven servers i.e. Gevent/Tornado/ Twisted or some > combination thereof etc. > > We are having doubts about the db io part. Even with connection > pooling and cache, there is a strong chance that server will blo

Re: Python Gotcha's?

2012-04-06 Thread Grzegorz Staniak
On 06.04.2012, rusi wroted: >> > This is the 21st century, not 1960, and if the language designer is >> > worried about the trivially small extra effort of parsing ' as well as " >> > then he's almost certainly putting his efforts in the wrong place. >> >> Yes, that's what you said already. My re

Re: Python Gotcha's?

2012-04-06 Thread rusi
On Apr 6, 8:40 pm, André Malo wrote: > * Steven D'Aprano wrote: > > On Thu, 05 Apr 2012 23:08:11 +0200, André Malo wrote: > > >> * Steven D'Aprano wrote: > > >>> For a 21st century programming language or data format to accept only > >>> one type of quotation mark as string delimiter is rather lik

Re: Python Gotcha's?

2012-04-06 Thread rusi
On Apr 6, 7:18 pm, Grzegorz Staniak wrote: > On 06.04.2012, Steven D'Aprano wroted: > > >> Are there languages (other than python) in which single and double > >> quotes are equivalent? > > > Classic REXX, CSS, JavaScript, Lua, Prolog, XPath, YAML, Modula-2, HTML, > > and (of course) English. The

Re: Python Gotcha's?

2012-04-06 Thread André Malo
* Steven D'Aprano wrote: > On Thu, 05 Apr 2012 23:08:11 +0200, André Malo wrote: > >> * Steven D'Aprano wrote: >> >>> For a 21st century programming language or data format to accept only >>> one type of quotation mark as string delimiter is rather like having a >>> 21st century automobile with

Re: Python Gotcha's?

2012-04-06 Thread rusi
On Apr 6, 6:55 pm, Steven D'Aprano wrote: > On Thu, 05 Apr 2012 21:28:01 -0700, rusi wrote: > > Are there languages (other than python) in which single and double > > quotes are equivalent? > > Classic REXX, CSS, JavaScript, Lua, Prolog, XPath, YAML, Modula-2, HTML, > and (of course) English. Ther

[ANN]: asyncoro: Framework for asynchronous programming with coroutines

2012-04-06 Thread Giridhar Pemmasani
I posted this message earlier to the list, but realized that URLs appear broken with '.' at the end of URL. Sorry for that mistake and this duplicate! asyncoro is a framework for developing concurrent programs with asynchronous event completions and coroutines. Asynchronous completions currently i

Re: [Savoynet] list settings

2012-04-06 Thread Chris Angelico
On Sat, Apr 7, 2012 at 12:50 AM, Freed wrote: > New here.  The list is set so that ‘reply’ goes only to the sender, not the > list.  Is that intentional?  Most lists are set so that ‘reply’ goes to the > list by default.  Doesn’t look like I can change that for emails that come > to me, can I? I

Re: Generating custom Windows installers

2012-04-06 Thread Cesar Covarrubias
I'm still getting my feet wet on the Windows side of things with Python, so I apologize for the noobish question. If i am reading the create_link.py example correctly, that is created when the application itself is invoked, not during installation. Is that correct? If it is, how would I be able to

Re: Python Gotcha's?

2012-04-06 Thread Grzegorz Staniak
On 06.04.2012, Steven D'Aprano wroted: >> Are there languages (other than python) in which single and double >> quotes are equivalent? > > Classic REXX, CSS, JavaScript, Lua, Prolog, XPath, YAML, Modula-2, HTML, > and (of course) English. There may be others. > > Other languages like Perl, PHP a

Re: Python Gotcha's?

2012-04-06 Thread Steven D'Aprano
On Thu, 05 Apr 2012 21:28:01 -0700, rusi wrote: > Are there languages (other than python) in which single and double > quotes are equivalent? Classic REXX, CSS, JavaScript, Lua, Prolog, XPath, YAML, Modula-2, HTML, and (of course) English. There may be others. Other languages like Perl, PHP an

Re: escaping/encoding/formatting in python

2012-04-06 Thread Serhiy Storchaka
06.04.12 16:22, rusi написав(ла): Yes. I hand it to you that I missed the case of explicitly unbalanced strings. But are not such cases rare? No, unfortunately. }:-( For example code such as: print '"' print str(something) print '"' could better be written as print '"%s"' % str(something)

Re: escaping/encoding/formatting in python

2012-04-06 Thread Serhiy Storchaka
06.04.12 08:28, rusi написав(ла): All this mess would vanish if the string-literal-starter and ender were different. [You dont need to escape a open-paren in a lisp sexp] But you need to escape an escape symbol. -- http://mail.python.org/mailman/listinfo/python-list

Re: escaping/encoding/formatting in python

2012-04-06 Thread rusi
On Apr 6, 1:52 pm, Nobody wrote: > On Thu, 05 Apr 2012 22:28:19 -0700, rusi wrote: > > All this mess would vanish if the string-literal-starter and ender > > were different. > > You still need an escape character in order to be able to embed an > unbalanced end character. > > Tcl and PostScript us

Re: Python Gotcha's?

2012-04-06 Thread mwilson
Roy Smith wrote: > In article , mwil...@the-wire.com wrote: > >> rusi wrote: >> >> > Are there languages (other than python) in which single and double >> > quotes are equivalent? >> >> Kernighan and Plauger's RATFOR (a pre-processor that added some C-like >> syntax to FORTRAN) did that. Publi

Re: Python Gotcha's?

2012-04-06 Thread Roy Smith
In article , mwil...@the-wire.com wrote: > rusi wrote: > > > Are there languages (other than python) in which single and double > > quotes are equivalent? > > Kernighan and Plauger's RATFOR (a pre-processor that added some C-like > syntax to FORTRAN) did that. Published in their book _Softwar

Re: escaping/encoding/formatting in python

2012-04-06 Thread Nobody
On Thu, 05 Apr 2012 22:28:19 -0700, rusi wrote: > All this mess would vanish if the string-literal-starter and ender > were different. You still need an escape character in order to be able to embed an unbalanced end character. Tcl and PostScript use mirrored string delimiters (braces for Tcl, p

Re: Python Gotcha's?

2012-04-06 Thread mwilson
rusi wrote: > Are there languages (other than python) in which single and double > quotes are equivalent? Kernighan and Plauger's RATFOR (a pre-processor that added some C-like syntax to FORTRAN) did that. Published in their book _Software Tools_. Mel. -- http://mail.python.org/mail

Re: Reading Live Output from a Subprocess

2012-04-06 Thread Nobody
On Thu, 05 Apr 2012 23:57:49 -0700, bunslow wrote: > Okay, I've been trying for days to figure this out, posting on forums, > Googling, whatever. I have yet to find a solution that has worked for me. > (I'm using Python 3.2.2, Ubuntu 11.04.) Everything I've tried has led to > buffered output being

numpy.genfromtxt with Python3 - howto

2012-04-06 Thread Helmut Jarausch
Hi I have a machine with a non-UTF8 local. I can't figure out how to make numpy.genfromtxt work I pipe some ascii data into the following script but get this bytes to str hell. Many thanks for a hint, Helmut. #!/usr/bin/python3 import numpy as np import io import sys inpstream = io.open(sys.s

Re: Reading Live Output from a Subprocess

2012-04-06 Thread Chris Rebert
On Thu, Apr 5, 2012 at 11:57 PM, wrote: > Okay, I've been trying for days to figure this out, posting on forums, > Googling, whatever. I have yet to find a solution that has worked for me. > (I'm using Python 3.2.2, Ubuntu 11.04.) Everything I've tried has led to > buffered output being spat b

Reading Live Output from a Subprocess

2012-04-06 Thread bunslow
Okay, I've been trying for days to figure this out, posting on forums, Googling, whatever. I have yet to find a solution that has worked for me. (I'm using Python 3.2.2, Ubuntu 11.04.) Everything I've tried has led to buffered output being spat back all at once after the subprocess terminates. I