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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ramlalr
New Contributor

Issue while extracting files from a zip file placed in files section of lakehouse

I have placed a zip file in a RAW subfolder under files folder in lakehouse, when I try to unzip using zipfile package getting  "FileNotFoundError: [Errno 2] No such file or directory: '/RAW/data_Q2_2017.zip'"

 

Code Used:

import zipfile
with zipfile.ZipFile("/RAW/data_Q2_2017.zip", 'r') as zip_ref:
    zip_ref.extractall()
1 ACCEPTED SOLUTION
v-cboorla-msft
Honored Contributor II

Hi @ramlalr 

 

Thanks for using Microsoft Fabric Community.

The error message you are seeing, โ€œFileNotFoundError: [Errno 2] No such file or directory: โ€˜/RAW/data_Q2_2017.zipโ€™โ€, typically means that Python cannot find the file youโ€™re trying to unzip. In your case, you are trying to unzip the file located at โ€œ/RAW/data_Q2_2017.zipโ€. This path is an absolute path, which means Python is looking for the file starting from the root directory (โ€œ/โ€). If your file is located in a subdirectory of your current working directory, you should use a relative path instead of an absolute path. A relative path starts from your current working directory, not from the root directory.

vcboorlamsft_0-1718359386014.png

 

I hope this information helps. Please do let us know if you have any further queries.

 

Thank you.

View solution in original post

3 REPLIES 3
v-cboorla-msft
Honored Contributor II

Hi @ramlalr 

 

Thanks for using Microsoft Fabric Community.

The error message you are seeing, โ€œFileNotFoundError: [Errno 2] No such file or directory: โ€˜/RAW/data_Q2_2017.zipโ€™โ€, typically means that Python cannot find the file youโ€™re trying to unzip. In your case, you are trying to unzip the file located at โ€œ/RAW/data_Q2_2017.zipโ€. This path is an absolute path, which means Python is looking for the file starting from the root directory (โ€œ/โ€). If your file is located in a subdirectory of your current working directory, you should use a relative path instead of an absolute path. A relative path starts from your current working directory, not from the root directory.

vcboorlamsft_0-1718359386014.png

 

I hope this information helps. Please do let us know if you have any further queries.

 

Thank you.

ramlalr
New Contributor

Thanks for the help

v-cboorla-msft
Honored Contributor II

Hi @ramlalr 

 

Glad that your query got resolved.
Please continue using Fabric Community for further queries.

 

Thank you.

Helpful resources

Announcements
Users online (2,085)