def declaration_path(name):
"""Return the path to an included declaration"""
from os.path import dirname, join, exists
import metatabdecl
from metatab.exc import IncludeError
d = dirname(metatabdecl.__file__)
path = join(d, name)
if not exists(path):
path = join(d, name + '.csv')
if not exists(path):
raise IncludeError("No local declaration file for name '{}' ".format(name))
return path
# From http://stackoverflow.com/a/295466
评论列表
文章目录