summaryrefslogtreecommitdiff
path: root/fs/zipfs.py
diff options
context:
space:
mode:
authorwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2008-09-19 16:17:55 +0000
committerwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2008-09-19 16:17:55 +0000
commiteef6b392d8a8c58c6b0e7fd5c7d1165241f8e030 (patch)
tree4ef192483daa2139afe09d52bcc6fe47b0c6c97f /fs/zipfs.py
parent068e7dcf028d0cd55b1886df25973700a3dc5cf2 (diff)
downloadpyfilesystem-git-eef6b392d8a8c58c6b0e7fd5c7d1165241f8e030.tar.gz
Fixes for zipfs and copydir
Diffstat (limited to 'fs/zipfs.py')
-rw-r--r--fs/zipfs.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/zipfs.py b/fs/zipfs.py
index 2e5dfaf..cfe383f 100644
--- a/fs/zipfs.py
+++ b/fs/zipfs.py
@@ -72,7 +72,10 @@ class ZipFS(FS):
raise ValueError("mode must be 'r', 'w' or 'a'")
self.zip_mode = mode
- self.zf = ZipFile(zip_file, mode, compression_type, allowZip64)
+ try:
+ self.zf = ZipFile(zip_file, mode, compression_type, allowZip64)
+ except IOError:
+ raise ResourceNotFoundError("NO_FILE", "Zip file does not exist: %(path)s")
self.zip_path = str(zip_file)
self.temp_fs = None
@@ -96,7 +99,8 @@ class ZipFS(FS):
def _add_resource(self, path):
if path.endswith('/'):
path = path[:-1]
- self._path_fs.makedir(path, recursive=True, allow_recreate=True)
+ if path:
+ self._path_fs.makedir(path, recursive=True, allow_recreate=True)
else:
dirpath, filename = pathsplit(path)
if dirpath: