[Tutor] Save file in a specific directory
Jerry Hill
malaclypse2 at gmail.com
Tue Dec 7 19:51:59 CET 2010
> When I run the script I got the next error:
>>>> import crawler_shp
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "crawler_shp.py", line 105, in <module>
> dbf = Dbf(d,new=False)
> File "C:\Python26\lib\site-packages\dbf.py", line 125, in __init__
> self.stream = file(f, ("r+b", "rb")[bool(readOnly)])
> IOError: [Errno 13] Permission denied: 'R:\\Aplicaciones\\IRISv3\\mis
> proyectos\
> \HURACAN\\BUFFER1000.dbf'
>
> The error is pointing to a library I used to make the script run: dbf.py. in
> thid lines:
> if isinstance(f, basestring):
> # a filename
> self.name = f
> if new:
> # new table (table file must be
> # created or opened and truncated)
> self.stream = file(f, "w+b")
> else:
> # tabe file must exist
> self.stream = file(f, ("r+b", "rb")[bool(readOnly)])
Sounds like you need to change your dbf object to something like this:
dbf = Dbf(d,new=False, readOnly=True)
Note that I don't know anything about the Dbf module, other than what
you just posted. If you really have read permission, but not write
permissions, this should do what you want though.
--
Jerry
More information about the Tutor
mailing list