Bug 388595

Summary: Python files aren't recognized as Python anymore
Product: [Applications] dolphin Reporter: Tobias Leupold <tl>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: elvis.angelaccio, nate, tl
Priority: NOR Keywords: usability
Version: 17.12.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Tobias Leupold 2018-01-05 19:46:20 UTC
(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.
Comment 1 Elvis Angelaccio 2018-01-07 17:35:00 UTC
What's the output of 'xdg-mime query filetype <filename>.py' ?
Comment 2 Tobias Leupold 2018-01-07 18:12:25 UTC
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.
Comment 3 Elvis Angelaccio 2018-01-07 18:26:21 UTC
(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?
Comment 4 Tobias Leupold 2018-01-07 18:29:48 UTC
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.
Comment 5 Elvis Angelaccio 2018-01-07 21:44:55 UTC
(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.
Comment 6 Tobias Leupold 2018-01-07 21:53:00 UTC
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.
Comment 7 Tobias Leupold 2018-01-07 22:00:26 UTC
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.
Comment 8 Tobias Leupold 2018-03-28 14:11:35 UTC
Still the same with Applications 17.12.3.
Comment 9 Nate Graham 2018-12-29 19:20:36 UTC
> 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 ***