Forum Discussion
notebookutils.fs.cp() cannot copy from Lakehouse shortcut to Files in Python notebook
I've been playing around with notebookutils.fs.cp() and notebookutils.fs.fastcp() in Fabric Python 3.12 notebooks.
This function seems to be unable to copy a file (e.g. PDF) from a SharePoint folder behind a Lakehouse shortcut to a directory in the Lakehouse Files. This produces a AzCopyFailedException.
Somewhat strangely, it is possible to use fs.cp() and fs.fastcp() to copy files from the shortcut to local file storage in the notebook environment and to then copy from this local file storage to the Lakehouse Files.
Has anyone come across a similar issue?
1 Reply
- v-saisrao-msft
Community Support
Hi svencken,
notebookutils.fs.cp() is documented to support copying across file systems. In Fabric Python notebooks, cp() uses the same AzCopy-based mechanism as fastcp().
Microsoft also documents SharePoint folders as supported OneLake shortcut sources. However, the linked documentation does not explicitly list this specific SharePoint shortcut → Lakehouse Files AzCopyFailedException as a known limitation.
Since the two-step copy from the shortcut to notebook-local storage and then to Lakehouse Files succeeds, this approach can be used as a workaround in your environment.
NotebookUtils file system utilities for Fabric - Microsoft Fabric | Microsoft Learn
Create a OneDrive or SharePoint shortcut - Microsoft Fabric | Microsoft Learn
Unify Data Sources With OneLake Shortcuts - Microsoft Fabric | Microsoft LearnUnify Data Sources With OneLake Shortcuts - Microsoft Fabric | Microsoft Learn
Thank you.