(At least here on Gentoo) As of 17.12.0, Dolphin shows the plain text icon for all Python files (with and without the .py extension). The MIME type still says e. g. "text/x-python3". When I open a Python file with KWrite, I also get no syntax highlighting. Just the plain black on white source. IIRC, this was not the case with 17.08.3 yet.
What's the output of 'xdg-mime query filetype <filename>.py' ?
It's "text/x-python3" for both files with and without the ".py" extension. I was not right with my first post – actually, files with a ".py" are recognized as Python by Dolphin. I just had to refresh the view after renaming them (I thought it would make no difference because after renaming, the plain text icon was still shown). Python files without the ".py" extension are not recognized as decribed above, neither by Dolphin, nor by KWrite.
(In reply to Tobias Leupold from comment #2) > Python files without the ".py" extension are not recognized as decribed > above, neither by Dolphin, nor by KWrite. Without the extension, they will be recognized as python files only if they start with the shebang line, e.g. "#!/bin/python3". Is that the case?
All have a shebang line. Both for "#!/usr/bin/python3" and "#!/usr/bin/env python3", "xdg-mime query filetype <filename>" returns "text/x-python3", and Dolphin displays the plain text icon.
(In reply to Tobias Leupold from comment #4) > All have a shebang line. Both for "#!/usr/bin/python3" and "#!/usr/bin/env > python3", "xdg-mime query filetype <filename>" returns "text/x-python3", and > Dolphin displays the plain text icon. Ok, I can reproduce this. Very strange, it only happens with python3 for me. If I remove the 3 from the shebang everything works as expected.
It's nice that you can also see it! As said, I'm pretty sure this wasn't the case until I updated from 17.08.3 to 17.12.0. But probably, this is some general problem, as it also affects KWrite and not only Dolphin.
Oh, and btw. it's the same here: I get the expected behavior both for the "#!/usr/bin/python" and the "#!/usr/bin/env python" shebang line, but not (anymore) for "#!/usr/bin/python3" and "#!/usr/bin/env python3". This definitely worked before.
Still the same with Applications 17.12.3.
> The MIME type still says e. g. "text/x-python3". This was an icon bug that I recently fixed: Bug 402367 *** This bug has been marked as a duplicate of bug 402367 ***