[yt-svn] commit/yt: xarthisius: Check if any argument passed to load() is a valid file

Bitbucket commits-noreply at bitbucket.org
Mon Mar 26 04:48:56 PDT 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/f79439c3bba1/
changeset:   f79439c3bba1
branch:      yt
user:        xarthisius
date:        2012-03-26 13:30:29
summary:     Check if any argument passed to load() is a valid file
affected #:  1 file

diff -r f66e9ce5d8aab699ed91977f4c1b9a5c68711aab -r f79439c3bba1a84fe6407c08d07cf825f1ab2bfe yt/convenience.py
--- a/yt/convenience.py
+++ b/yt/convenience.py
@@ -86,6 +86,12 @@
     candidates = []
     args = [os.path.expanduser(arg) if isinstance(arg, types.StringTypes)
             else arg for arg in args]
+    valid_file = [os.path.isfile(arg) if isinstance(arg, types.StringTypes) 
+            else False for arg in args]
+    if not any(valid_file):
+        mylog.error("None of the arguments provided to load() is a valid file")
+        mylog.error("Please check that you have used a correct path")
+        return None
     for n, c in output_type_registry.items():
         if n is None: continue
         if c._is_valid(*args, **kwargs): candidates.append(n)

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list