Bugs item #1724822, was opened at 2007-05-24 14:56
Message generated for change (Comment added) made by gjb1002
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1724822&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: Python 2.5
Status: Closed
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Geoffrey Bache (gjb1002)
Assigned to: Nobody/Anonymous (nobody)
Summary: shlex.split problems on Windows

Initial Comment:
What is shlex.split supposed to do on Windows? It seems to be present but it 
can't handle basic Windows pathnames : shlex.split("C:\\directory\\file") 
returns C:directoryfile (whereas os.system happily accepts the same string).

Also, it runs in POSIX mode and there is no way to override it! Why isn't POSIX 
mode the default on POSIX systems and not on non-POSIX systems? Or for it to at 
least be possible to says shlex.split(s, posix=False)?


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

>Comment By: Geoffrey Bache (gjb1002)
Date: 2007-05-24 16:52

Message:
Logged In: YES 
user_id=769182
Originator: YES

But surely it's not named "POSIX mode" for no reason. It's because those
rules resemble those of the UNIX shell. While "non-POSIX mode" resemble
those of non-POSIX shells, such as DOS.

shlex.split seemed to be a shortcut for those wanting to simply parse a
generic quoted string who weren't interested in creating a minilanguage.
Surely it should be possible to avoid POSIX rules when doing this on
Windows?

You haven't suggested any other way to do this. The fact is, I do want to
parse a Windows command line. The only way I have found is by copying
shlex.split and hacking it. Didn't seem very nice, especially it seems a
fix would be totally trivial, but it's obviously better than starting from
scratch.

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

Comment By: Georg Brandl (gbrandl)
Date: 2007-05-24 16:26

Message:
Logged In: YES 
user_id=849994
Originator: NO

Further quote: "This will often be useful for writing minilanguages, (for
example, in run control files for Python applications) or for parsing
quoted strings."

Why shouldn't that feature not be available under Windows?
Again, shlex is *not supposed* to handle Windows command lines.

Also, http://docs.python.org/lib/shlex-parsing-rules.html clearly says
what the difference between
"posix=True" and "posix=False" is.

That non-posix mode works on Windows filenames is because it does not
handle backslash escapes.

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

Comment By: Geoffrey Bache (gjb1002)
Date: 2007-05-24 16:19

Message:
Logged In: YES 
user_id=769182
Originator: YES

Then what is "non-POSIX mode" if it's only supposed to work on UNIX?

I noted the initial comment but it seemed to be out of date. Especially as
it
seems to work fine to copy shlex.split and correct the default value for
"posix".
Seemed a very simple change that had little chance of being wrong.

If Windows behaviour is really unsupported then surely the function should
not
be available there.


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

Comment By: Georg Brandl (gbrandl)
Date: 2007-05-24 15:09

Message:
Logged In: YES 
user_id=849994
Originator: NO

The docs to shlex say: "The shlex class makes it easy to write lexical
analyzers for simple syntaxes resembling that of the Unix shell."

It is not meant to be a cross-platform shell quoting handler, but an
implementation of Unix shell behavior.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1724822&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to