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:ย 

How to load a json file in pyspark with colon character in file name

laus
New Contributor III

Hi,

I'm trying to load this json file which contains the colon character in its name: file_name.2022-03-05_11:30:00.json but I get the error in screenshot below saying that there is a relative path in an absolute url -

Any idea how to read this file?

file_name = file_name.2022-03-05_11:30:00.json

imageThanks for your help in advance!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Laura Blancarteโ€‹ , I apologize for the late response... Try replacing the colons in the file name with %3A. This will work by replacing the colons with URL encoded format.

View solution in original post

7 REPLIES 7

User16741082858
Contributor III

Hi @Laura Blancarteโ€‹ . Have you tried saving the file path to a list?

laus
New Contributor III

Hi @Pearl Ubaruโ€‹ ,

Thanks for your reply.

Yes, I have a list of path files through which I loop and try to load the file at the current index but I get the same error about there being a relative path. Am I missing something?

Ty!

Is it okay if I see a bit more of your code? Preferably the list and loop?

laus
New Contributor III

@Pearl Ubaruโ€‹ , Sure, here it is:

image

Hi @Laura Blancarteโ€‹ , I apologize for the late response... Try replacing the colons in the file name with %3A. This will work by replacing the colons with URL encoded format.

Kaniz_Fatma
Community Manager
Community Manager

Hi @Laura Blancarteโ€‹ , Just a friendly follow-up. Do you still need help, or @Pearl Ubaruโ€‹ 's response help you to find the solution? Please let us know.

Noopur_Nigam
Valued Contributor II
Valued Contributor II

Hi @Laura Blancarteโ€‹ I hope that @Pearl Ubaruโ€‹'s answer would have helped you in resolving your issue.Please let us know if you need more help on this.

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!