Reputation: 11
I'm trying to use the Azure Synapse notebook reference described here:
Here is my setup, notebook_1 and notebook_2 are both under root folder of Synapse notebooks.
I have a notebook_1 published in workspace and then trying to call it in notebook_2 using
%run 'notebook_1'
Got an error syaing:
MagicUsageError: Cannot read notebook 'notebook_1'. The possible reason is that the notebook doesn't exist.
Could anyone give an advice on the proper way of doing that? Many thanks.
Upvotes: 1
Views: 9175
Reputation: 1702
Also make sure that the notebook you're trying to call has been published. More info on calling a notebook can be found here: Run another synapse notebook (included below)
You can reference other notebooks in a Synapse notebook activity via calling %run magic or mssparkutils notebook utilities. Both support nesting function calls. The key differences of these two methods that you should consider based on your scenario are:
%run magic copies all cells from the referenced notebook to the %run cell and shares the variable context. When notebook1 references notebook2 via %run notebook2 and notebook2 calls a mssparkutils.notebook.exit function, the cell execution in notebook1 will be stopped. We recommend you use %run magic when you want to "include" a notebook file.
mssparkutils notebook utilities calls the referenced notebook as a method or a function. The variable context isn't shared. When notebook1 references notebook2 via mssparkutils.notebook.run("notebook2") and notebook2 calls a mssparkutils.notebook.exit function, the cell execution in notebook1 will continue. We recommend you use mssparkutils notebook utilities when you want to "import" a notebook.
Upvotes: 1
Reputation: 12768
Try to remove the single quote marks in the notebook to resolve the issue:
Upvotes: 3