Nautilus and Nemo don't recognize python 3 files

Finally I could fix it!

As far as I understand, Nemo and Nautilus try to load a file named text-x-python3.svg from /usr/share/icons/[MyTheme]/mimes/[ActualIconSize]/. If there is such a file in ~/.local/share/icons/[MyTheme]/mimes/[ActualIconSize]/ it has a higher priority. But none of these directories existed for my theme: Humanity-Dark.

So Nemo/Nautilus try to find that icon in another theme. In /usr/share/icons/Humanity-Dark/index.theme is defined which theme to try next:

$ grep Inherits /usr/share/icons/Humanity-Dark/index.theme 
Inherits=Humanity,Adwaita,hicolor

Next try is Humanity. There are icons for text-x-python but not for text-x-python3. So I did:

mkdir -p ~/.local/share/icons/Humanity-Dark/mimes/48
cp /usr/share/icons/Humanity/mimes/48/text-x-python.svg ~/.local/share/icons/Humanity-Dark/mimes/48/text-x-python3.svg

Same for icon sizes 16 and 22. Now it looks as expected:

Python icons as expected

Maybe this solution is helpful for someone else.


I had a nearly identical problem in Thunar. I had a slightly different solution. I'm using the elementary Xfce icon theme, so change the commands below as appropriate:

sudo ln -s /usr/share/icons/elementary-xfce/mimes/32/text-x-python.png /usr/share/icons/elementary-xfce/mimes/32/text-x-python3.png
sudo ln -s /usr/share/icons/elementary-xfce/mimes/48/text-x-python.png /usr/share/icons/elementary-xfce/mimes/48/text-x-python3.png
sudo ln -s /usr/share/icons/elementary-xfce/mimes/64/text-x-python.png /usr/share/icons/elementary-xfce/mimes/64/text-x-python3.png
sudo update-icon-caches /usr/share/icons/*

The last command to refresh the icon cache was necessary for me to see the changes in Thunar. After running the commands above I simply refreshed the directory in Thunar and everything was working as expected.