[yt-svn] commit/yt: xarthisius: Fallback to test_data_dir in load() if file is not found
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Sep 6 05:15:39 PDT 2013
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/c5d2839b5b7a/
Changeset: c5d2839b5b7a
Branch: yt
User: xarthisius
Date: 2013-09-06 13:00:10
Summary: Fallback to test_data_dir in load() if file is not found
Affected #: 1 file
diff -r 82c39f06779818dc31a267c38f7f0adbc079705b -r c5d2839b5b7af432baf7c2e8db8bf75350314341 yt/convenience.py
--- a/yt/convenience.py
+++ b/yt/convenience.py
@@ -58,8 +58,19 @@
candidates = []
args = [os.path.expanduser(arg) if isinstance(arg, types.StringTypes)
else arg for arg in args]
- valid_file = [os.path.exists(arg) if isinstance(arg, types.StringTypes)
- else False for arg in args]
+ valid_file = []
+ for argno, arg in enumerate(args):
+ if isinstance(arg, types.StringTypes):
+ if os.path.exists(arg):
+ valid_file.append(True)
+ else:
+ if os.path.exists(os.path.join(ytcfg.get("yt", "test_data_dir"), arg)):
+ valid_file.append(True)
+ args[argno] = os.path.join(ytcfg.get("yt", "test_data_dir"), arg)
+ else:
+ valid_file.append(False)
+ else:
+ valid_file.append(False)
if not any(valid_file):
try:
from yt.data_objects.time_series import TimeSeriesData
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