Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm not recognizing Python files

Tags:

python

pycharm

PyCharm is no longer recognizing Python files. The interpreter path is correctly set.

Screen shot

like image 677
belteshazzar Avatar asked Jul 27 '12 11:07

belteshazzar


People also ask

Why is my Python code not running in PyCharm?

To fix this go to Settings or press Ctrl+Alt+S go to Project > Project Interpreter and from the Project Interpreter dropdown select Show All then from the list select the python.exe on its current path and press the + symbol on your right.

Where is Python file in PyCharm?

Search in the specific file typesFrom the main menu, select Edit | Find | Find in Files Ctrl+Shift+F . In the Find in Files dialog, select the File Mask checkbox and from the list of file types, select the one you need. PyCharm limits its search to the specified type.


2 Answers

Please check File | Settings (Preferences on macOS) | Editor | File Types, ensure that file name or extension is not listed in Text files.

To fix the problem remove it from the Text files and double check that .py extension is associated with Python files.

Text

like image 149
CrazyCoder Avatar answered Oct 15 '22 11:10

CrazyCoder


I had a similar problem where certain .py files were showing up as regular text files after completion, thus rendering the code without syntax coloring, tab completion features, etc. Through using this post as a starting point for debugging the issue, I found the following:

  1. (from OSX): PyCharm → Preferences → IDE Settings → File Types
  2. Select the affected File Type from the list on the top half of this dialog box, Recognized File Types (in my case, Text Files)
  3. Listed in the second half of the dialog box, Registered Patterns were the names of the files that I was having naming/syntax issues with. I clicked on each of those and then clicked on the - for each in turn to remove them from the Registered Patterns list.
  4. Click Apply
  5. Sigh of relief when the syntax highlighting returns and the icon changes back to that of a python file.
like image 32
Vanessa Wallis Avatar answered Oct 15 '22 09:10

Vanessa Wallis