Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
morz3d
Advocate I
Advocate I

Saved files are not visible in lakehouse web interface

Hi, 

I want to make a dailiy backup of my PBI reports with notebook script and i came across unexpected problem where when i try to save file in lakehose it is simply not visible in folder even after some time (5 mins). 
Here is a simple example to ilustrate. 

So when i run this notebook to save simple file, and then to read it and list directory content i can see that file is saved in Files folder, nowever web interface is showing that this folder doesnt have any content.




import os

# Define the content and the filename
text_content = "This is the content of the text file."
directory = "Files"
filename = os.path.join(directory, "filename.txt")

# Example usage
directory = "Files"
delete_folder(directory)

# Create the directory if it does not exist
if not os.path.exists(directory):
    os.makedirs(directory)

# Write the content to the file
with open(filename, "w") as file:
    file.write(text_content)
    
# Read the content of the file
try:
    with open(filename, "r") as file:
        content = file.read()
    print("File content:")
    print(content)
except FileNotFoundError:
    print(f"The file {filename} does not exist.")
except IOError as e:
    print(f"An IOError occurred: {e}")

# List files and directories in the specified directory
try:
    files_and_dirs = os.listdir(directory)
    print("Files and directories in '", directory, "':")
    for item in files_and_dirs:
        print(item)
except FileNotFoundError:
    print(f"The directory {directory} does not exist.")
except PermissionError:
    print(f"Permission denied to access {directory}.")        

morz3d_0-1722950376907.png

 

 

1 ACCEPTED SOLUTION
v-jingzhan-msft
Community Support
Community Support

Hi @morz3d 

 

Try replacing the current directory "Files" with "/lakehouse/default/Files". You can get this path via "Copy File API path" option. After the execution, Refresh the folder or browser to view the file. 

vjingzhanmsft_0-1722998401326.png

 

Based on my test, this should work. 

vjingzhanmsft_0-1722998606378.png

 

If you select "Copy relative path for Spark", you will get "Files". I guess this applies to Spark but doesn't apply when you use the regular os module in Python. 

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

3 REPLIES 3
morz3d
Advocate I
Advocate I

Thanks @v-jingzhan-msft 
I always tried with "Copy relative path for Spark" but was surprise as there is no error and files are not to be find using web interface but listed if you try to list folder.

File API pathe seams to solve the problem

I find a documentation which should be helpful. It introduces these paths. And the ABFS path returns the absolute path of the file, which should always work. 

Load data into your lakehouse with a notebook - Microsoft Fabric | Microsoft Learn

v-jingzhan-msft
Community Support
Community Support

Hi @morz3d 

 

Try replacing the current directory "Files" with "/lakehouse/default/Files". You can get this path via "Copy File API path" option. After the execution, Refresh the folder or browser to view the file. 

vjingzhanmsft_0-1722998401326.png

 

Based on my test, this should work. 

vjingzhanmsft_0-1722998606378.png

 

If you select "Copy relative path for Spark", you will get "Files". I guess this applies to Spark but doesn't apply when you use the regular os module in Python. 

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.