Fixed bug involved in finding env when running module.

This commit is contained in:
cwandrews
2017-10-11 21:49:39 -04:00
parent 489d22cbcb
commit 53f6cc055f
4 changed files with 59 additions and 36 deletions

View File

@ -71,14 +71,14 @@ def read(filename, module, install=False, quiet=False, verbose=False, default_en
requirements = os.path.join(os.path.dirname(filename), 'requirements.txt')
_install_requirements(requirements)
context = runpy.run_path(filename, run_name='__bonobo__')
env_dir = Path(filename).parent
elif module:
context = runpy.run_module(module, run_name='__bonobo__')
filename = context['__file__']
env_dir = Path(module)
else:
raise RuntimeError('UNEXPECTED: argparse should not allow this.')
env_dir = Path(filename).parent or Path(module).parent
if default_env_file:
for f in default_env_file:
env_file_path = env_dir.joinpath(f)