Reputation: 25
So I accidentally opened a python file in Pycharm and set it to always open in Pycharm by accident. I got that problem fixed quickly by setting it to open in Python like this: Picture of me changing the python file back to python
However now all my python file icons are long and black icons which looks like command prompt and in the file type column instead of saying Python File it says PY file: Picture of what my python file icon now looks like
Now I know this doesn't seem like a problem since I haven't really ran into any actual problems when I try to the python file but it really triggers me and I just want it to look like what it looked like before. I found a picture online of what I mean: Picture of how I want my python file to look like
So if anyone knows how to fix this please help me.
Edit: I've tried using the python shell to open the files with no luck. It still looks wrong.
Edit 2 : Incase it wasn't clear. I already have the python files opening in python as you can see in the first image in the question.
Edit 3: I fixed my problem by deleting Python then redownloading it (a newer version) and then when I went to the properties of one of the python files and clicked change. A new icon for python showed up it looked like this. Picture of what the icon for the right icon file looks like
My files now look like this !!!!! Pic of what my files now look like I'm so happy its fixed
Upvotes: 2
Views: 1549
Reputation: 38
If you have the latest python version and any method doesn't works as mentioned above then do the following steps although be careful as it requires registry tweaking.
Press Win+R and type Computer\HKEY_CLASSES_ROOT\Python.File\DefaultIcon
and enter. When the registry shows up, double click on (default), erase the text in Value data and paste the following address into the Value data: "C:\Users\{user}\AppData\Local\Programs\Python\Python39\DLLs\py.ico"
(replace the {user} with the username of the computer)(also, replace the Python39 with the current Python folder if you don't have Python 3.9)
After that is done, close the registry and type the following commands in the command prompt
TASKKILL /F /IM explorer.exe
then type
start explorer.exe
and the problem should be fixed! :)
Upvotes: 1
Reputation:
To fix it you have to reset to icon cache you can try two methods if you are using windows
type the below cmd & enter
ie4uinit.exe -show
2.Create a .bat file and paste the following lines in it and then run it.
taskkill /f /im explorer.exe
cd /d %userprofile%\AppData\Local
del IconCache.db /a
start explorer.exe
Upvotes: 0