Search code examples
pythonjupyter-notebook

%run on files with space in names


I'm trying to use the magic command %run on a notebook which has spaces in the filename.

%run Crazy Code.ipynb
ERROR:root:File `'Crazy.py'` not found.

Is there a way around this without changing the file name? I have a lot of notebooks whose names have spaces in between words; I find it easier to read.


Solution

  • File names with spaces in them are typically wrapped in double quotes to solve this problem. In your case, this would be:

    %run "Crazy Code.ipynb"