[RESOLVED] Python file views as text file

Hello,

In PyCharm I created a text file named 'name_file'. But I wanted a python file. Then I renamed it as 'name_file.py'.

Now Pycharm see always it as text file.

Even with the py extension, the icon near the name file is a text file icon, not a python icon.

If I delete the file and I create it again it's the same. It's impossible to have a python file with this name : 'name_file.py'.

I have deleted the pycharm project configuration, and I import again the project in pycharm : it's the same think.

In Visual Studio Code, it's ok.

How to resolve this?

Thanks.

See you soon.

6 comments
Comment actions Permalink

Hello, 

 

Please check the file types associations settings https://www.jetbrains.com/help/pycharm/creating-and-registering-file-types.html for the text file type, there might be a pattern ``name_file`` added. 

0
Comment actions Permalink

Hi,

Thanks for your suggest. But it's not the issue.

The Pycharm text parameter is *.txt.

The file name 'name_file.py' has not been inserted here.

Sorry.

See you soon.

0
Comment actions Permalink

Please attach a screenshot of file types associations settings for the txt format.

Starting the IDE with default settings as described here https://www.jetbrains.com/help/pycharm/configuring-project-and-ide-settings.html#restore-defaults might do the trick. 

 

 

1
Comment actions Permalink

Hi,
Thanks for your suggestion.

I restart the IDE with default settings and now it's ok.

But now, I must do a new configuration of the ide. It's a pity!

Good day to you.

1
Comment actions Permalink
Antonina Belianskaya's suggestion also worked for me. Thank you!
0
Comment actions Permalink

I managed to solve this without having to reset to default settings.

[Ctrl + Alt + S] Settings/Preferences | Editor | File Types | File type auto-detected by file content

You probably have your .py file there. Remove it from the list and editor will see it now as a Python file.

0

Please sign in to leave a comment.