I am programmatically executing notebooks using nbconvert.preprocessors.ExecutePreprocessor. My notebooks depend on resources specified by relative file name, and I cannot get the kernel to run with a specified directory as the working directory. In other words, this:
runPath = r'd:\blah\myPreferredDirectory'
proc = ExecutePreprocessor(timeout=600, kernel_name='python3')
proc.preprocess(nb, {'metadata': {'path':runPath}})
...is not respecting the specified path. If I insert a printout of the current directory into my notebook, it isn't the specified directory, though if I specify an invalid directory, I do get an error, so it's at least confirming that the directory exists. Modifying the notebooks to explicitly change directories is not an option.
Advice?
Using the nbconvert command line would be fine as well, though I slightly prefer to do this programmatically.