Pycharm stopped syntax highlight on __init__.py files

Answered

Today for some reason Pycharm stopped syntax highlighting.

I created a file __init__ in the terminal `touch __init__` and forgot the `.py` extension. From that moment on all the __init__.py files are identified as `plain text` files. Is there some way to revert back or to change the settings so that it can correctly do syntax highlighting on `__init__.py`?

 

5 comments
Comment actions Permalink

Please try starting with defaults by renaming/removing configuration folder https://intellij-support.jetbrains.com/hc/en-us/articles/206544519. Does it help?

1
Comment actions Permalink

Hi Sergey, 

When you say "Please try starting with defaults by renaming/removing configuration folder". Which folder is that specifically? This is is "/Users/johannesscr/Library/Preferences/PyCharm2018.3".

As additional information: If I create any other file with the extension ".py" the syntax highlighting is correct, it is only the __init__.py that has no syntax highlighting.

1
Comment actions Permalink

Yes, for Mac OS it is 

~/Library/Preferences/<PRODUCT><VERSION>

Please rename or remove it and start with defaults. To make sure no custom plugins are causing the problem, do the same for plugins folder (~/Library/Application Support/<PRODUCT><VERSION>).

1
Comment actions Permalink

Same here. Maybe you have already solved, but for those facing this issue:

Preferences>Editor>File Types. In Recognized File Types, choose Text and remove __init__.py from Registered Patterns.

2
Comment actions Permalink

@bertoldo thank you so much. Worked perfectly finally! I had lost auto-complete in every module in every environment of mine because of this thing!

0

Please sign in to leave a comment.