simple python in vscode and filenotfound error in terminal
I get this error everytime I try to reference a file in this way, or with the long file path.
I’ve tried with json files as well but get the same error. I followed some tutorials on youtube and expected there to be no problems whatsoever, but I can’t seem to find a durable solution. However, Copilot did provide me with a solution, but I would prefer not to rely on it everytime as I didn’t really understand it, I just copy pasted it and it worked, but here it is:
Get the current directory of the script
current_directory = os.path.dirname(os.path.abspath(file))
Construct the absolute path to the CSV file
csv_file_path = os.path.join(current_directory, “googleplaystore.csv”)
user24967984 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1