<div class="gmail_quote">On 11 September 2011 22:59, Platonides <span dir="ltr">&lt;<a href="mailto:platonides@gmail.com">platonides@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">Also, I&#39;m not sure if urllib.open() works with file:// urls, but I&#39;d</div>
verify it&#39;s a http or https url .<br>
<div><div></div><div class="h5"><br></div></div></blockquote><div><br></div><div>It even works without. For urllib2, you do need to use file:// urls.</div><div><br></div><div>valhallasw@dorthonion:~$ python</div><div>Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)</div>

<div>[GCC 4.4.3] on linux2</div><div>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</div><div>&gt;&gt;&gt; import urllib, urllib2</div><div>&gt;&gt;&gt; urllib.urlopen(&#39;/etc/passwd&#39;).readlines()</div>

<div>[&#39;root:x:0:0:root:/root:/bin/bash\n&#39;, (...) ,&#39;usbmux:x:109:46:usbmux daemon,,,:/home/usbmux:/bin/false\n&#39;]</div><div><div>&gt;&gt;&gt; urllib2.urlopen(&#39;file:///etc/passwd&#39;).readlines()</div><div>

[&#39;root:x:0:0:root:/root:/bin/bash\n&#39;, (...)</div></div><div><br></div><div>Of course, it all boils back to the old motto &#39;never trust user input&#39; - and be sure standard libraries are not more general than you think... </div>

<div><br></div><div>(and this is something that might have bitten more of us, including me :-))</div><div><br></div><div>Best,</div><div>Merlijn</div></div>