[Liblas-commits] hg: Moved the file existence check inside a read check

liblas-commits at liblas.org liblas-commits at liblas.org
Thu May 12 17:01:29 EDT 2011


details:   http://hg.liblas.orghg/rev/756213b4604a
changeset: 2941:756213b4604a
user:      Pete Gadomski <pete.gadomski at gmail.com>
date:      Thu May 12 14:01:23 2011 -0700
description:
Moved the file existence check inside a read check

diffstat:

 python/liblas/file.py |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (17 lines):

diff -r e5f99ed25421 -r 756213b4604a python/liblas/file.py
--- a/python/liblas/file.py	Thu May 12 13:58:41 2011 -0700
+++ b/python/liblas/file.py	Thu May 12 14:01:23 2011 -0700
@@ -130,10 +130,10 @@
         """Open the file for processing, called by __init__
         """
         
-        if not os.path.exists(self.filename):
-            raise OSError("No such file or directory: '%s'" % self.filename)
-        
         if self._mode == 'r' or self._mode == 'rb':
+            
+            if not os.path.exists(self.filename):
+                raise OSError("No such file or directory: '%s'" % self.filename)
 
             if self._header == None:
                 self.handle = core.las.LASReader_Create(self.filename)


More information about the Liblas-commits mailing list