cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid Path when getting Notebook Path

Steve_Harrison
New Contributor III

The undocumented feature to get a notebook path as is great but it does not actually return a valid path that can be used in python, e.g.:

from pathlib import Path

print(Path(dbutils.notebook.entry_point.getDbutils().notebook().getContext().notebookPath().get()).exists())

Always returns False. Is there a method of getting the actual path of a notebook?

The above suffers from two problems:

  1. It appears to strip off the /Workspace from the start of the path
  2. It removes the suffix from the path

2 is not so much of an issue but the first one is a royal pain.

0 REPLIES 0

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group