<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 10/21/2013 12:45 PM, Marco Passanisi
wrote:<br>
</div>
<blockquote
cite="mid:CACkemLkvQHT7nC53GPTZjN1m=x0m17FXcgVWCCM0ULBBNcxt8Q@mail.gmail.com"
type="cite">
<div><br>
</div>
<div>
<pre style="margin-top:0px;margin-bottom:0px"><div class="" id="LC44" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;color:rgb(51,51,51);padding-left:10px"><span class="">import subprocess</span></div><div class="" id="LC44" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;color:rgb(51,51,51);padding-left:10px">
<span class="">output</span> <span class="" style="font-weight:bold">=</span> <span class="">subprocess</span><span class="" style="font-weight:bold">.</span><span class="">Popen</span><span class="">(</span><span class="" style="color:rgb(221,17,68)">'"C:\Windows\System32\dnscmd.exe" /EnumZones'</span><span class="">,</span> <span class="">shell</span><span class="" style="font-weight:bold">=</span><span class="" style="color:rgb(153,153,153)">True</span><span class="">,</span> <span class="">stdout</span><span class="" style="font-weight:bold">=</span><span class="">subprocess</span><span class="" style="font-weight:bold">.</span><span class="">PIPE</span><span class="">,</span> <span class="">stderr</span><span class="" style="font-weight:bold">=</span><span class="">subprocess</span><span class="" style="font-weight:bold">.</span><span class="">PIPE</span><span class="">)</span></div>
<div class="" id="LC45" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;color:rgb(51,51,51);padding-left:10px"><span class="">out</span><span class="">,</span> <span class="">err</span> <span class="" style="font-weight:bold">=</span> <span class="">output</span><span class="" style="font-weight:bold">.</span><span class="">communicate</span><span class="">()</span></div>
<div class="" id="LC46" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span class=""><font color="#333333">print</font></span><span class="" style="color:rgb(51,51,51)">(err</span><span class="" style="color:rgb(51,51,51)">)</span></div></pre>
</div>
</blockquote>
<br>
Ciao, innanzitutto, come ti hanno detto, dovresti usare delle
stringhe raw. Pero' il problema non e' questo, perche' sei stato
fortunato e nessuna delle sequenze di caratterei \x fa parte di una
sequenza di escape ;) <br>
Inoltre, quando usi shell=True, la stringa viene eseguita dalla
shell sottostante, quindi avresti potuto scrivere direttamente:<br>
<br>
<pre style="margin-top:0px;margin-bottom:0px"><span class="">subprocess</span><span class="" style="font-weight:bold">.</span><span class="">Popen</span><span class="">(</span><span class="" style="color:rgb(221,17,68)">"C:\Windows\System32\dnscmd.exe /EnumZones"</span><span class="">,</span> <span class="">shell</span><span class="" style="font-weight:bold">=</span><span class="" style="color:rgb(153,153,153)">True</span><span class="">,...)
Quindi, anche se sembra banale, credo che il problema sia che nel tuo sistema non esiste il file </span><span class=""><span class="" style="color:rgb(221,17,68)">C:\Windows\System32\dnscmd.exe...</span> </span></pre>
Puoi verificare? Ad esempio, nel mio non c'e':<br>
<br>
$ ls Windows/System32/dnsc*<br>
Windows/System32/dnscacheugc.exe Windows/System32/dnscmmc.dll<br>
<br>
<br>
<pre class="moz-signature" cols="72">--
Marco Buttu
INAF - Osservatorio Astronomico di Cagliari
Via della Scienza, Loc. Cuccuru Angius
09047 Selargius (CA)
Phone: 070 711 80 217
Email: <a class="moz-txt-link-abbreviated" href="mailto:mbuttu@oa-cagliari.inaf.it">mbuttu@oa-cagliari.inaf.it</a></pre>
</body>
</html>