SHELLS ARE NOT CROSS-PLATFORM!!!! Seriously, there are going to be differences. If you really must:

escape = lambda s: s.replace('^', '^^') if os.name == 'nt' else s

Viola.



On Wed, Jun 11, 2014 at 5:53 PM, anatoly techtonik <techtonik@gmail.com> wrote:
On Thu, Jun 12, 2014 at 1:30 AM, Chris Angelico <rosuav@gmail.com> wrote:
On Thu, Jun 12, 2014 at 7:58 AM, Ryan <rymg19@gmail.com> wrote:
> In all seriousness, to me this is obvious. When you pass a command to the
> shell, naturally, certain details are shell-specific.

On Windows cmd.exe is used by default:
so it makes sense to make default behavior cross-platform.
 
> -10000. Bad idea. Very bad idea. If you want the ^ to be escaped, do it
> yourself. Or better yet, don't pass shell=True.

Definitely the latter. Why pass shell=True when executing a single
command? I don't get it.

This is a complete use case using Rietveld upload script:

I am interested to know how to modify upload script without kludges:
I expect many people are facing with the same problem trying to wrap
Git and HG with Python scripts.
--
anatoly t.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com




--
Ryan
If anybody ever asks me why I prefer C++ to C, my answer will be simple: "It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was nul-terminated."