[issue8776] Bytes version of sys.argv

2014-04-29 Thread Nick Coghlan
Nick Coghlan added the comment: Makes sense to me. Assuming we eventually manage to resolve the POSIX locale issue, the bytes variant will become even less useful. -- resolution: later - rejected status: open - closed ___ Python tracker

[issue8776] Bytes version of sys.argv

2014-04-28 Thread Nick Coghlan
Nick Coghlan added the comment: I'd like to revisit this after PEP 432 is in place, since having to do this dance for arg processing when running on Linux in the POSIX locale is somewhat lame: argv = sys.argv encoding = locale.getpreferredencoding() # Hope nobody changed the locale!

[issue8776] Bytes version of sys.argv

2014-04-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: Without commenting on this specific proposal, I would like to make an overall observation that Python is impairing its usability by adding too-many-ways-to-it in a number of categories (file descriptor variants of file methods, multiple versions of

[issue8776] Bytes version of sys.argv

2014-04-28 Thread STINNER Victor
STINNER Victor added the comment: Today I regret os.environb (I added it). If I remember correctly, os.environb was added before the PEP 383 (surrogateescape). This PEP makes os.environb almost useless. In Python 3, Unicode is the natural choice, and thanks to the PEP 383, it's still possible

[issue8776] Bytes version of sys.argv

2011-04-12 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: One year after opening the issue, I don't have any real use case. And there are technical issues to implement this feature, so I prefer just to close this issue. Reopen it if you really want it, but please give an use case ;-)

[issue8776] Bytes version of sys.argv

2010-12-14 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- stage: - needs patch type: - feature request versions: +Python 3.3 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8776 ___

[issue8776] Bytes version of sys.argv

2010-10-24 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Prototype (in Python) of argvb.py. Try it with: ./python -i argvb.py. It's not possible to create sys.argvb in Python in a module loaded by Py_Initialize(), because sys.argv is created after Py_Initialize(). -- Added file:

[issue8776] Bytes version of sys.argv

2010-10-20 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Since r85765 (issue #4388), always use UTF-8 to decode the command line arguments on Mac OS X, not the locale encoding. Which means that the pseudo-code becomes: if os.name != 'nt': if sys.platform == 'darwin':

[issue8776] Bytes version of sys.argv

2010-07-28 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Using that approach would work on POSIX systems. As os.environb, I think that sys.argv should not exist on Windows. Another problem I see is synchronizing the two os.environ and os.environb are synchronized. It would be possible

[issue8776] Bytes version of sys.argv

2010-07-28 Thread Marc-Andre Lemburg
Marc-Andre Lemburg m...@egenix.com added the comment: STINNER Victor wrote: STINNER Victor victor.stin...@haypocalc.com added the comment: Using that approach would work on POSIX systems. As os.environb, I think that sys.argv should not exist on Windows. Another problem I see is

[issue8776] Bytes version of sys.argv

2010-07-27 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: no byte-oriented representation of the command line is readily available. Why not using the following recipe? encoding = locale.getpreferredencoding() sys.argvb = [arg.decode(encoding, 'surrogateescape') for arg in argv]

[issue8776] Bytes version of sys.argv

2010-07-27 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: You should read .encode(), not .decode() :-/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8776 ___

[issue8776] Bytes version of sys.argv

2010-07-27 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8776 ___ ___ Python-bugs-list

[issue8776] Bytes version of sys.argv

2010-07-27 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Using that approach would work on POSIX systems. Another problem I see is synchronizing the two. If some function strips arguments from sys.argv (because it has completed processing), sys.argvb would still keep the arguments. Of course,

[issue8776] Bytes version of sys.argv

2010-05-20 Thread STINNER Victor
New submission from STINNER Victor victor.stin...@haypocalc.com: In some situations, the encoding of the command line is incorrect or unknown. sys.argv is decoded with the file system encoding which can be wrong. Eg. see issue #4388 (ok, it's a bug, it should be fixed). As os.environb, it

[issue8776] Bytes version of sys.argv

2010-05-20 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: sys.argv is decoded with the file system encoding IIRC this is not exact. Py_Main signature is Py_Main(int argc, wchar_t **argv) then PyUnicode_FromWideChar is used, and there is no conversion (except from UCS4 to UCS2). The

[issue8776] Bytes version of sys.argv

2010-05-20 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: The wchar_t strings themselves are built with mbstowcs(), the file system encoding is not used. Oops sorry, you are right, and it's worse :-) sys.argv is decoded using the locale encoding, but subprocess cie use the file system

[issue8776] Bytes version of sys.argv

2010-05-20 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8776 ___

[issue8776] Bytes version of sys.argv

2010-05-20 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: As os.environb, it would be useful to have bytes version of sys.argv to have able to decide the encoding used to decode each argument, or to manipulate bytes if we don't care about the encoding. -1. Py_Main expects wchar_t*, so no