<br><br><div class="gmail_quote">On Thu, Sep 6, 2012 at 8:55 PM, ruck <span dir="ltr"><<a href="mailto:john.ruckstuhl@gmail.com" target="_blank">john.ruckstuhl@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
(This with Python 2.7.2 on Windows 7)<br>
<br>
os.stat() won't recognize a filename ending in period.<br>
It will ignore trailing periods.<br>
If you ask it about file 'goo...' it will report on file 'goo'<br>
And if 'goo' doesn't exist, os.stat will complain.<br>
<br>
create file goo, then<br>
<br>
    >>> os.stat('goo')<br>
    nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=0L, st_atime=1346978160L, st_mtime=1346978160L, st_ctime=1346978160L)<br>
    >>> os.stat('goo...')<br>
    nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=0L, st_atime=1346978160L, st_mtime=1346978160L, st_ctime=1346978160L)<br>
<br>
rename goo to "goo...", then,<br>
<br>
    >>> os.stat('goo...')<br>
<br>
    Traceback (most recent call last):<br>
      File "<pyshell#16>", line 1, in <module><br>
        os.stat('goo...')<br>
    WindowsError: [Error 2] The system cannot find the file specified: 'goo...'<br>
You can try: the other, then if not there except:mkdir<span class="HOEnZb"><font color="#888888"><a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank"></a> goo<br></font></span></blockquote><div><br>
and obviously, don't use ..., use ___, or something else. <br></div><div><br>It also sems that the file must exist, so did you have a file named 'goo...'? If not, it wouldn't create one, so you would have to, either by manual, or coded by a try/except. Below is how it could go:<br>
<br><br>import os<br>try:<br>     os.stat('/home/david/whatever')<br>except:<br>os.mkdir('/home/david/whatever')<br> <br><br></div></div><br><br clear="all"><br>-- <br>Best Regards,<br><span style="font-family:arial,helvetica,sans-serif">David Hutto</span><br>
<i><b>CEO:</b></i> <u><a href="http://www.hitwebdevelopment.com" target="_blank">http://www.hitwebdevelopment.com</a></u><br><br>