Skip to content

Instantly share code, notes, and snippets.

@tomr-stargazer
Last active October 21, 2016 03:32
Show Gist options
  • Save tomr-stargazer/9f6448b4bfc5e93011f463bfe6980003 to your computer and use it in GitHub Desktop.
Save tomr-stargazer/9f6448b4bfc5e93011f463bfe6980003 to your computer and use it in GitHub Desktop.
Error output when pyradex.Radex.datapath is not set
➜ ~ unset RADEX_DATAPATH
➜ ~ echo $RADEX_DATAPATH
➜ ~ pylab
Python 2.7.12 |Anaconda 4.0.0 (x86_64)| (default, Jul 2 2016, 17:43:17)
Type "copyright", "credits" or "license" for more information.
IPython 4.1.2 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
Using matplotlib backend: MacOSX
In [1]: import pyradex
In [2]: R = pyradex.Radex(species='oh2co-h2', abundance=1e-8, column=1e14, temperature=20)
WARNING: Did not find data file for species oh2co-h2 in path . Downloading it. [pyradex.base_class]
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-2-047ffb4fcbb5> in <module>()
----> 1 R = pyradex.Radex(species='oh2co-h2', abundance=1e-8, column=1e14, temperature=20)
/Users/tsrice/anaconda2/lib/python2.7/site-packages/pyradex/core.pyc in __init__(self, collider_densities, density, total_density, temperature, species, column, column_per_bin, tbackground, deltav, abundance, datapath, escapeProbGeom, outfile, logfile, debug, mu, source_area)
290 raise ValueError("Data path %s was not successfully stored;"
291 " instead %s was." % (datapath,self.datapath))
--> 292 self.species = species
293 if self.molpath == b'':
294 raise ValueError("Must set a species name.")
/Users/tsrice/anaconda2/lib/python2.7/site-packages/pyradex/base_class.pyc in species(self, species)
130 "in path {1}. Downloading it.".format(species,
131 self.datapath))
--> 132 utils.get_datafile(species, self.datapath)
133 self.molpath = os.path.join(self.datapath,species+'.dat')
134
/Users/tsrice/anaconda2/lib/python2.7/site-packages/pyradex/utils.pyc in get_datafile(species, savedir)
42
43 if not os.path.isdir(savedir):
---> 44 mkdir_p(savedir)
45
46 if not os.path.isfile(datapath):
/Users/tsrice/anaconda2/lib/python2.7/site-packages/pyradex/utils.pyc in mkdir_p(path)
11 """ mkdir -p equivalent [used by get_datafile]"""
12 try:
---> 13 os.makedirs(path)
14 except OSError as exc: # Python >2.5
15 if exc.errno == errno.EEXIST and os.path.isdir(path):
/Users/tsrice/anaconda2/lib/python2.7/os.pyc in makedirs(name, mode)
155 if tail == curdir: # xxx/newdir/. exists if xxx/newdir exists
156 return
--> 157 mkdir(name, mode)
158
159 def removedirs(name):
OSError: [Errno 2] No such file or directory: ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment