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"><<a href="mailto:john.arbash.meinel@gmail.com">john.arbash.meinel@gmail.com</a>></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>
> Antoine Pitrou wrote:<br>
>> Robert Kern <robert.kern <at> <a href="http://gmail.com" target="_blank">gmail.com</a>> writes:<br>
>>> Since one may have more than one filesystem side-by-side, this can't be just<br>
>> be<br>
>>> a system-wide boolean somewhere. One would have to query the target directory<br>
>>> for this information. I am not aware of the existence of code that does such<br>
>> a<br>
>>> query, though.<br>
>> Or you can just be practical and test for it. Create a file "foobar" and see if<br>
>> you can open "FOOBAR" in read mode...<br>
><br>
> Agreed. Â That is how Bazaar's test suite detects this, and it works well.<br>
><br>
> -Andrew.<br>
<br>
<br>
</div></div>Actually, I believe we do:<br>
<br>
open('format', 'wb').close()<br>
try:<br>
 os.lstat('FoRmAt')<br>
except IOError, e:<br>
 if e.errno == errno.ENOENT:<br>
 ...<br>
<br>
I don't know that it really matters, just wanted to indicate we use<br>
'lstat' rather than 'open()' to check. I could be wrong about the test<br>
suite, but I know that is what we do for 'live' files. (We always create<br>
a format file, so we know it is there to 'stat' 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