Author lemburg
Recipients eric.araujo, lemburg, pitrou, r.david.murray, vstinner
Date 2010-08-13.14:04:53
SpamBayes Score 0.0
Marked as misclassified No
Message-id <4C655103.8020709@egenix.com>
In-reply-to <1281706339.17.0.144370350465.issue9560@psf.upfronthosting.co.za>
Content
STINNER Victor wrote:
> 
> STINNER Victor <victor.stinner@haypocalc.com> added the comment:
> 
>> Looking at the only use case of _syscmd_file(), it may not even 
>> be worth the trouble of adding the -b option. Fixing the doc-string 
>> may be enough: (...)
> 
> Well, my problem is that _syscmd_file() fails with a non encodable filename on Linux because the file program writes the filename to stdout, but os.popen() is unable to parse it because the filename is not decodable from the filesystem encoding (without surrogateescape).
> 
> I would like to add -b option just to avoid this encoding problem.
> 
> The bug:
> ---
> $ cp /bin/ls $(echo -ne "ls-\x80")
> $ ./python -c "import platform; platform.architecture(executable='ls-\uDC80')"
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
>   File "/home/SHARE/SVN/py3k/Lib/platform.py", line 1059, in architecture
>     output = _syscmd_file(executable, '')
>   File "/home/SHARE/SVN/py3k/Lib/platform.py", line 1006, in _syscmd_file
>     output = f.read().strip()
>   File "/home/SHARE/SVN/py3k/Lib/codecs.py", line 300, in decode
>     (result, consumed) = self._buffer_decode(data, self.errors, final)
> UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 24: invalid start byte
> ---
> 
> See also #8611 and #9425.

Ah, right. Well, then we probably have to use -b after all.

A note on your example: executable is really only meant to be used for
pointing platform to a non-standard location of the Python interpreter
(e.g. in case you used a freeze tool or embedded Python in an application).

However, it is still possible to have that path contain weird
characters, so the example is still valid.

> @lemburg: Your mail client likes to change the issues' title by adding some spaces :-)

The problem is related to the way Mailman splits long subject lines
in the header. The roundup email interface should probably
remove any extra spaces or simply ignore the title altogether.
History
Date User Action Args
2010-08-13 14:04:56lemburgsetrecipients: + lemburg, pitrou, vstinner, eric.araujo, r.david.murray
2010-08-13 14:04:54lemburglinkissue9560 messages
2010-08-13 14:04:53lemburgcreate