Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening/Attempting to Read a file [duplicate]

I tried to simply read and store the contents of a text file into an array, but:

ins = open( "file.txt", "r" )
array = []
for line in ins:
    array.append( line )
ins.close()

It gives me an error for "open":

Unresolved reference 'open' less... (Ctrl+F1) 

This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.

Can anyone explain what I'm doing wrong? Thanks

like image 558
Évariste Galois Avatar asked Aug 05 '14 19:08

Évariste Galois


People also ask

What causes files to duplicate?

Downloading the Same File Twice Downloading files multiple times is the most common reason you end up having duplicates on your computer. In many cases, we unknowingly download files twice from email attachments, websites, and social media apps, which accumulate over time and make matters worse.

How do I open duplicate files in Word?

Microsoft Word 2010 and later Press the keyboard shortcut Ctrl + O , or click the File tab in the Ribbon and click Open. Go to the location of the document you want to duplicate. Right-click the file, and click Open as copy. A new file opens and is named Copy of Document, Document 2, or similar.


1 Answers

This is a known issue in PyCharm, when it fails to update its cache of the interpreter. It happens most often if you install a new interpreter, update packages, etc.

You can search for this and related issues at the pycharm bug tracker

Its a temporary problem and will resolve itself. Keep an eye on the bottom right of the PyCharm window where it displays notifications (next to the icon of the guy in the hat). Click on this and the Event Log will have some messages for you.

If its really bothering you, you can hit ALT+ENTER and click "Ignore unresolved reference open"

like image 140
Burhan Khalid Avatar answered Sep 23 '22 06:09

Burhan Khalid