Open file error

Screen Link:

from csv import reader

open_file = open(r’C:\Users\dsimhadr\Desktop\Dataquest\googleplaystore.csv’)
read_file = reader(open_file)
android = list(read_file)
android_header = android[0]
android = android[1:]

open_file = open(r"C:\Users\dsimhadr\Desktop\Dataquest\AppleStore.csv")
read_file = reader(open_file)
apple = list(read_file)
apple_header = apple[0]
apple = apple[1:]

What I expected to happen: Open the file

What actually happened:
FileNotFoundErrorTraceback (most recent call last)
in ()
1 from csv import reader
----> 3 open_file = open(r’C:\Users\dsimhadr\Desktop\Dataquest\googleplaystore.csv’)
4 read_file = reader(open_file)
5 android = list(read_file)

FileNotFoundError: [Errno 2] No such file or directory: ‘C:\\Users\\dsimhadr\\Desktop\\Dataquest\\googleplaystore.csv’

Other details:

Hi @dinesh46800

You don’t have to write the full path of the file location, which is in your local machine, because you are working on the Dataquest Juypter Notebook, where the data set is already in the same folder in the backend of the server.

So, for accessing the file in the same folder, you have to write its file name only.

Correct code to open file:

open_file = open('googleplaystore.csv')
open_file = open('AppleStore.csv')

I hope this helps :slightly_smiling_face: .

Hello. I have similar issue.
Regarding the Guided Project: Profitable App Profiles for the App Store and Google Play Markets.

So I’m trying to access the the file in the same folder.
please see th ecode and the error. Could you help me to figure out what I’m missing, why the error occurs?


from csv import reader

The Google Play data set

opened_file = open(‘googleplaystore.csv’)
read_file = reader(opened_file)
android = list(read_file)
android_header = android[0]
android = android[1:]


UnicodeDecodeError Traceback (most recent call last)
4 opened_file = open(‘googleplaystore.csv’)
5 read_file = reader(opened_file)
----> 6 android = list(read_file)
7 android_header = android[0]
8 android = android[1:]

~\Anaconda3\lib\encodings\ in decode(self, input, final)
21 class IncrementalDecoder(codecs.IncrementalDecoder):
22 def decode(self, input, final=False):
—> 23 return codecs.charmap_decode(input,self.errors,decoding_table)[0]
25 class StreamWriter(Codec,codecs.StreamWriter):

UnicodeDecodeError: ‘charmap’ codec can’t decode byte 0x90 in position 2755: character maps to

1 Like

Hopefully this post will help you.

1 Like

from csv import reader

The Google Play data set

opened_file = open(‘googleplaystore.csv’, encoding = ‘utf8’)
read_file = reader(opened_file)
android = list(read_file)
android_header = android[0]
android = android[1:]

i am getting this error, can you please help?
TypeErrorTraceback (most recent call last)
in ()
4 ### The Google Play data set ###
----> 5 opened_file = open(‘googleplaystore.csv’, encoding = ‘utf8’)
6 read_file = reader(opened_file)
7 android = list(read_file)

TypeError: ‘_io.TextIOWrapper’ object is not callable

1 Like

An Update, I did a restart and run all in kernel and it worked!!. Although the error is gone but if someone can let me know the cause of it, for future understanding, it would be great. Thanks

1 Like

Next time please post your question in a separate topic.

Judging by the error, I’d say the issue is that you wrote something like open = open(‘googleplaystore.csv’, encoding = ‘utf8’), overwriting the open built-in function, and then you fixed the code, which is way it executed without issues when you reran the notebook.


Ohh, yeah, did something like that, reminds me of the lesson, never keep a variable name as built-in function. But the thing was that even after fixing the code (and not actually re-running the notebook), it didn’t work properly, perhaps because that’s the way it works, rerunning the original code too. Will remember it for future. Thanks a lot for the solution

Sorry for not creating a separate topic, I saw people posting similar issues in the thread (error for file opening), so I thought it would be convenient for all to have it under one banner. Will remember for next time.

Yes, because open was kept in memory even after fixing and rerunning the code. Restarting the kernel gets rid of everything.

No worries.

If it’s the same question as the starting topic, then posting in the topic itself is fine. But presumably there will be an answer and you won’t need to post. If the answers aren’t helpful, a new topic linking to the old one and explaining that the answers didn’t hep and why is good.

If it’s a different question, then start a new topic.

Yeah, I can now recall the ‘memory’ issue explained in the Dataquest course. Guess we learn better from the experiences.

Will also remember about posting the questions. Thanks for all the help

1 Like