Cannot run another notebook from same directory

fix_databricks
New Contributor II

Hello, I am having a similar problem from this thread which was never resolved: https://community.databricks.com/t5/data-engineering/unexpected-error-while-calling-notebook-string-...

 

I renamed a notebook (utility_data_wrangling) which I am using in my current notebook. When I do 

%run "./utility_metrics" (a different notebook), it runs fine. But when I run 
%run "./utility_data_wrangling" it gives me the error:

Failed to parse %run command: string matching regex `\$[\w_]+' expected but `%' found. If notebook path contains spaces, wrap with double quotes. Stacktrace: /Shared/Inbound Forecasting/testing_error: python

This seems to break something fundamentally because now %run "./utility_metrics" will give the same error even when commenting out %run "./utility_data_wrangling"

feiyun0112
Honored Contributor

The error message indicates that the notebook name contains special characters, please modify the notebook name to contain only English letters, and remove double quotation marks

%run ./utility123

 

It has no special characters, like I mentioned it's just utility_data_wrangling. It does not work with or without the double quotation marks.

ddundovic
New Contributor III

I am running into the same issue. It seems like the `%run` magic command is trying to parse the entire cell content as its arguments. So if you have

%run "my_notebook"

print("hello")

in the same cell, you will get the following error: `Failed to parse %run command: string matching regex '\$[\w_]+' expected but 'p' found. If notebook path contains spaces, wrap with double quotes.` But if you remove the `print("hello")`, it will run fine.

This is quite frustrating and I would assume that it's a bug.