community,
I encountered the following issue. I have several classes/ files that I am editing in PyCharm. As you can see PyCharm recognises every file as a valid .py file except the PresidentsPage

The problem about that is that auto-completion and code formatting isn't working properly. I already tried to create a new file and copy and pasting the code in there. Sadly that didn't work. Maybe one of you has a smart idea :)


I also checked the extensions in the Preferences. They are perfectly fine

When I rename the file to something stupid like 'PjresidentsPage' it is shown as a Python file

I have seen this issue before, after mistakenly creating a .py module as a plain text file, PyCharm will auto-register that specific filename as a text file.
Navigate to Settings -> Editor -> File Types.
Under Recognized File Types panel, select the Text file type.
Under Registered Patterns panel, find your filename PresidentsPage.py and remove it from the registered patterns (by clicking the "-" icon on right). Click Apply.
Now recreate your file as .py file, not a plain text file.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With