[ python-Bugs-788035 ] missing universal newline support in os.popen & friends

SourceForge.net noreply at sourceforge.net
Tue Jan 13 05:45:47 EST 2004


Bugs item #788035, was opened at 2003-08-13 13:17
Message generated for change (Comment added) made by philiplindsay
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=788035&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Torsten Marek (shlomme)
Assigned to: Nobody/Anonymous (nobody)
Summary: missing universal newline support in os.popen & friends

Initial Comment:
In contrast to the documentation, os.popen and relatives do not 
support the "U" format character in their constructors.

os.popen("some_nifty_command some_arg", "rU")
throws
OSError: [Errno 22] Invalid argument ,
while os.popen{2,3,4} just ignores "U".
I noticed that behaviour while p-opening oggenc (the ogg vorbis 
encoder), which uses curses for output. The lines end with \r and not 
with \n (due to some ncurses internals, I suspect), so that the file 
objects readline() function cannot split the output.

----------------------------------------------------------------------

Comment By: Philip Lindsay (philiplindsay)
Date: 2004-01-13 10:45

Message:
Logged In: YES 
user_id=254205

See
<http://advogato.org/person/follower/diary.html?start=43>
for details of a possible interim work around. (WFM, YMMV)

----------------------------------------------------------------------

Comment By: Peter Åstrand (astrand)
Date: 2003-11-03 20:01

Message:
Logged In: YES 
user_id=344921

I've added universal newline support to popen5.
http://www.lysator.liu.se/~astrand/popen5/. 

----------------------------------------------------------------------

Comment By: Jack Jansen (jackjansen)
Date: 2003-08-26 22:04

Message:
Logged In: YES 
user_id=45365

Theoretically this is easy to fix: if mode=="U" or "rU" just pass "r" 
to popen(), "rb" to fdopen() and _O_BINARY to the lowlevel calls, 
and the original string to PyFile_FromFile.

But this whole popen{,2,3,4} section of posixmodule.c is so 
fiendishly complicated with all the platform special cases that I'm 
loath to touch it...

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=788035&group_id=5470



More information about the Python-bugs-list mailing list