Reputation: 1376
In a notebook I have the following in a cell:
cwd = os.getcwd()
run cwd + "/plot_data.py"
I get the error:
ERROR:root:File `'cwd.py'` not found.
Apparently, run thinks I am trying to run a python file "cwd.py" with the options "+" and "plot_data.py".
Actually I am trying to run a file plot_data.py located in cwd
Upvotes: 0
Views: 418
Reputation: 231738
Create the full file name, and pass it to run
with the $
prefix:
file = cwd + "/plot_data.py"
run $file
In
run cwd + "/plot_data.py"
cwd
is the file parameter, to be run, and '+' and "/plot..." are arguments that get passed to it. This isn't a Python expression (which would preform the string join).
Upvotes: 1