A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20140611/c25eba8f/attachment.html below:

<html><head></head><body>Of course! And, why not escape everything else, too?<br>
<br>
abc -> ^a^b^c<br>
<br>
echo %PATH% -> ^e^c^h^o^ ^%^P^A^T^H^%<br>
<br>
In all seriousness, to me this is obvious. When you pass a command to the shell, naturally, certain details are shell-specific.<br>
<br>
-10000. Bad idea. Very bad idea. If you want the ^ to be escaped, do it yourself. Or better yet, don't pass shell=True.<br><br><div class="gmail_quote">anatoly techtonik <techtonik@gmail.com> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr">I am banned from tracker, so I post the bug here:<div><br /></div><div>Normal Windows behavior:</div><div><br /></div><div>  >hg status --rev ".^1"</div><div>  M mercurial\commands.py<br /></div><div>

  ? pysptest.py<br /></div><div><br /></div><div>  >hg status --rev .^1</div><div>  abort: unknown revision '.1'!<br /></div><div><br /></div><div>So, ^ is an escape character. See <a href="http://www.tomshardware.co.uk/forum/35565-45-when-special-command-line">http://www.tomshardware.co.uk/forum/35565-45-when-special-command-line</a></div>

<div><br /></div><div><br /></div><div>But subprocess doesn't escape it, making cross-platform command fail on Windows.</div><div><br /></div><div>---[cut pysptest.py]--</div><div><div>import subprocess as sp</div><div><br />

</div><div># this fails with</div><div># abort: unknown revision '.1'!</div><div>cmd = ['hg', 'status', '--rev', '.^1']</div><div># this works</div><div>#cmd = 'hg status --rev ".^1"'</div>

<div># this works too</div><div>#cmd = ['hg', 'status', '--rev', '.^^1']</div><div><br /></div><div>try:</div><div>  print sp.check_output(cmd, stderr=sp.STDOUT, shell=True)</div><div>except Exception as e:</div>

<div>  print e.output</div><div>------------------------------</div><div><br /></div>-- <br />anatoly t.


</div></div>
<p style="margin-top: 2.5em; margin-bottom: 1em; border-bottom: 1px solid #000"></p><pre class="k9mail"><hr /><br />Python-Dev mailing list<br />Python-Dev@python.org<br /><a href="https://mail.python.org/mailman/listinfo/python-dev">https://mail.python.org/mailman/listinfo/python-dev</a><br />Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com">https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com</a><br /></pre></blockquote></div><br>
-- <br>
Sent from my Android phone with K-9 Mail. Please excuse my brevity.</body></html>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4