Tim Golden added the comment:
On 14/11/2013 00:21, Laurent Birtz wrote:
Is it reasonable to believe that most Python programs don't care
about the legacy shell API?
No more than it is to believe that most Python programs don't care about
MSys or Cygwin ;)
For information, cmd.exe will
Laurent Birtz added the comment:
Thank you for the clarifications on the usage of cmd.exe and shell=True. I tend
to forget that the shell support in subprocess isn't just about UNIX.
The point of running msys is getting programs to work as if they were in a
limited UNIX environment without
ThurnerRupert added the comment:
david, you mentioned working code. i am the opposite of an expert in the source
code of python, but i thought i would be able to at least find where the code
is for sys.stdout.write and sys.stderr.write, where i thought \ should be
replaced by / when running
Nick Coghlan added the comment:
You certainly can't replace *all* occurrences of backslash characters with
forward slashes when running in a cygwin or msys shell anyway. Backslashes have
many uses besides being (annoyingly) Windows path separators.
--
Eric V. Smith added the comment:
Agreed with Nick. I think it's clear than any change to the behavior will have
to take place inside os.path. I just don't know what that change would be.
--
___
Python tracker rep...@bugs.python.org
Nick Coghlan added the comment:
As noted above, it's still not clear the change *can* be implemented at the
standard library level - we don't have the context to determine if a Windows
native path or a POSIX path is more appropriate when a Windows build is being
used in a POSIX environment.
Laurent Birtz added the comment:
First, I apologize for my overly harsh tone. A dismissive comment above struck
a nerve but that doesn't excuse it.
@Lawrence: from my perspective it is a bug: the Python interpreter doesn't
handle paths correctly on MinGW as I'd expect.
As Nick said, the
Nick Coghlan added the comment:
We can't change os.sep globally for the process because the Windows APIs
don't reliably accept forward slashes. Changing it when the Windows binary
is run through msys would thus mean potentially breaking currently working
applications.
Using the Cygwin Python
Nick Coghlan added the comment:
However, coming up with a way to detect that msys is in use, and publishing
that information for use by applications like Mercurial, or creating a
catalogue of which Windows APIs still don't accept forward slashes as path
separators could help the issue progress.
Laurent Birtz added the comment:
I agree with the no magic bullet point and that Microsoft is fully to blame
for the situation.
About the catalogue of Windows APIs that accept slashes. I've read in various
places that the only problematic case is the legacy shell API. The power shell
seems
Terry J. Reedy added the comment:
subprocess has a 'shell=True' option, although its use is discouraged unless
really necessary. To pursue this, I suggest running the test suite on Windows
(including xp) with os.sep changed.
--
___
Python tracker
Laurent Birtz added the comment:
In my opinion, the decision to cross your arms and pretend there is no issue is
unprofessional.
Summary of your arguments:
- It's Microsoft's fault.
- Windows accepts backslashes anyway.
- Shell detection is difficult.
- It's a complex issue.
None of this is
Mark Lawrence added the comment:
How can you rant about something won't get fixed when it's an enhancement
request? If it's that important and/or so simple the OP or anyone else for
that matter can provide a patch, including tests and doc changes. Given that
the issue is nearly 4 1/2 years
R. David Murray added the comment:
I think both of you could stand to turn down the rhetoric :)
Laurent: we're not saying there's no issue, we're saying we don't see an
acceptable fix for the issue.
So the bottom line is that for this situation to improve someone is going to
have to go
Nick Coghlan added the comment:
There's also the fact that *Cygwin's* Python will behave like a *nix Python
and use backslashes. It's only the Windows Python that follows Windows
platform conventions.
So there's already a reasonable workaround in the cygwin case: use the
version which relies on
Mark Lawrence added the comment:
Can this issue to confined to the small round filing cabinet, mainly on the
grounds that I find some of the wording undecipherable?
--
nosy: +BreamoreBoy
___
Python tracker rep...@bugs.python.org
Eric V. Smith added the comment:
I say close it. Any shell detection is likely to be fragile, and any changes
are likely to break something. It's not worth the risk.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6208
Terry J. Reedy added the comment:
The resolution should be 'This is a gawd-awful mess created by Microsoft 30
years ago and we already do the best we sensibly can to deal with it' ;-) (and
sensible people know it would be a mess from the first day).
To put is another way, the answer to the
Eric Smith e...@trueblade.com added the comment:
So is this a cosmetic issue or a functional issue?
It's a cosmetic issue.
Also, even if it could figure that out, how would it know whether
a particular filename stringification with os.path.join() was
intended for display to the user or
Tim Golden m...@timgolden.me.uk added the comment:
Eric Smith wrote:
Eric Smith e...@trueblade.com added the comment:
So is this a cosmetic issue or a functional issue?
It's a cosmetic issue.
Also, even if it could figure that out, how would it know whether
a particular filename
Eric Smith e...@trueblade.com added the comment:
Tim Golden wrote:
Just for information's sake, the shell APIs usually only accept backslashes.
That's good to know. Do you have any specific examples?
CreateFile and the like, which is where my experience is, take either.
90% of my Windows
ThurnerRupert rupert.thur...@credit-suisse.com added the comment:
the parent process would be sh.exe in the msys case, contrary to the
windows standard cmd.exe, explorer.exe, system, system idle
process, ...
an example is the mercurial status command, see
Terry J. Reedy tjre...@udel.edu added the comment:
Rupert, your original posts mislabels slash '/' and backslach '\' as the
opposite. I have no idea what change you are requesting. Please post a
minimal (line or two) code example with actual output and desired output.
I do not know if
Nick Coghlan ncogh...@gmail.com added the comment:
I'm not sure Python *can* change its behaviour in this case. How would
it know which shell (cmd or msys/cygwin) it was launched from?
Also, even if it could figure that out, how would it know whether a
particular filename stringification with
ThurnerRupert rupert.thur...@credit-suisse.com added the comment:
if one installes python for windows with the provided installer, and
then run this python from mingw/msys or cygwin, python prints
backslash as path separator instead of forward slash.
it would be nice if python would notice
R. David Murray rdmur...@bitdance.com added the comment:
That would mean that python's notion of which OS it was running on
(windows or cygwin) would have to change depending on which shell it was
lanched from. This affects far more than the path seperator, and as far
as I know is not practical
ThurnerRupert rupert.thur...@credit-suisse.com added the comment:
to give an example case, running mercurial, which we do for a couple
of years now with success. one install, starting it either from cmd,
or mingw/msys bash:
$ hg status
M src\com\file.txt
$ hg co -m different path now
R. David Murray rdmur...@bitdance.com added the comment:
So is this a cosmetic issue or a functional issue? Either way, it is a
feature request and I've updated the issue to reflect that.
If you want to look at the code, ntpath.py is probably the relevant module.
--
priority: normal -
New submission from ThurnerRupert rupert.thur...@credit-suisse.com:
when installing python for windows and running it from a msys or cygwin
shell, python does not notice that the path separator is backslash /
instead of forward slash \.
can this be configured somehow, so the outputs are done
Changes by ThurnerRupert rupert.thur...@credit-suisse.com:
--
components: +IO, Windows
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6208
___
___
R. David Murray rdmur...@bitdance.com added the comment:
I'm not sure I understand the quesiton. The cygwin path separator is
forward slash, isn't it? Beyond that, I'm not clear on what behavior
you think is incorrect. What outputs?
--
components: +Installation -IO
nosy:
31 matches
Mail list logo