From 8162c8bb367a1236cbc3c1cf61319092c9892551 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sun, 7 Jul 2013 23:48:51 +0200 Subject: [PATCH] Handle FUSE unavailability correctly --- pytahoe/__init__.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pytahoe/__init__.py b/pytahoe/__init__.py index e0c56c6..4b11568 100644 --- a/pytahoe/__init__.py +++ b/pytahoe/__init__.py @@ -283,17 +283,26 @@ class Directory: fs = TahoeLAFS(self.uri, webapi=self.filesystem.url) + mount_failed = False + try: return fuse.mount(fs, mountpoint) except OSError: + mount_failed = True + except NameError: + mount_failed = True + except RuntimeError, e: + raise MountException("Could not mount the directory because a FUSE error was encountered: %s" % e.message) + + if mount_failed: try: return dokan.mount(fs, mountpoint) except OSError: raise DependencyException("Could not mount the directory because both the FUSE and dokan libraries are unavailable.") + except NameError: + raise DependencyException("Could not mount the directory because both the FUSE and dokan libraries are unavailable.") except RuntimeError, e: raise MountException("Could not mount the directory because a dokan error was encountered: %s" % e.message) - except RuntimeError, e: - raise MountException("Could not mount the directory because a FUSE error was encountered: %s" % e.message) def upload(self, filedata, filename=None): """Upload a file to the storage grid and return a File object representing it.