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/20090508/7fd64c45/attachment.htm below:

<br><br><div class="gmail_quote">On Thu, May 7, 2009 at 18:56, John Arbash Meinel <span dir="ltr">&lt;<a href="mailto:john.arbash.meinel@gmail.com">john.arbash.meinel@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div><div></div><div class="h5">Andrew Bennetts wrote:<br>


&gt; Antoine Pitrou wrote:<br>
&gt;&gt; Robert Kern &lt;robert.kern &lt;at&gt; <a href="http://gmail.com" target="_blank">gmail.com</a>&gt; writes:<br>
&gt;&gt;&gt; Since one may have more than one filesystem side-by-side, this can&#39;t be just<br>
&gt;&gt; be<br>
&gt;&gt;&gt; a system-wide boolean somewhere. One would have to query the target directory<br>
&gt;&gt;&gt; for this information. I am not aware of the existence of code that does such<br>
&gt;&gt; a<br>
&gt;&gt;&gt; query, though.<br>
&gt;&gt; Or you can just be practical and test for it. Create a file &quot;foobar&quot; and see if<br>
&gt;&gt; you can open &quot;FOOBAR&quot; in read mode...<br>
&gt;<br>
&gt; Agreed. Â That is how Bazaar&#39;s test suite detects this, and it works well.<br>
&gt;<br>
&gt; -Andrew.<br>
<br>
<br>
</div></div>Actually, I believe we do:<br>
<br>
open(&#39;format&#39;, &#39;wb&#39;).close()<br>
try:<br>
 Â os.lstat(&#39;FoRmAt&#39;)<br>
except IOError, e:<br>
 Â if e.errno == errno.ENOENT:<br>
 Â  ...<br>
<br>
I don&#39;t know that it really matters, just wanted to indicate we use<br>
&#39;lstat&#39; rather than &#39;open()&#39; to check. I could be wrong about the test<br>
suite, but I know that is what we do for &#39;live&#39; files. (We always create<br>
a format file, so we know it is there to &#39;stat&#39; it via a different name.)</blockquote><div><br>Thanks for the help to everyone. I ended up simply taking __file__, making it all uppercase (or lowercase if it is already uppercase) and then doing os.path.exists() on the modified name. Seems to work.<br>

<br>-Brett <br></div></div><br>



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