urbansim_templates icon indicating copy to clipboard operation
urbansim_templates copied to clipboard

Better management of python working directory

Open smmaurer opened this issue 6 years ago • 0 comments

UrbanSim notebooks often begin with a command to change the Python working directory. This is clunky and annoying, and breaks if you accidentally run the cell more than once. Surely we can do better!

My recollection from looking into this in the past is that the two objectives with changing the directory are (a) for python to be able to import datasources.py and related scripts and (b) to line up with some settings in the core urbansim library that expect configs and data to be in a particular location relative to the python working directory. ModelManager's initialize() command also looks for config files relative to the working directory.

Maybe we could write a utility function that takes a relative path argument and makes sure the right thing happens?

This will be particularly useful when we're running notebooks in multiple environments, because the initial working directory may vary.

smmaurer avatar Aug 23 '18 22:08 smmaurer