I am writing a GUI application in Python using PyQt5, with the main application named main_app.py
. Despite being simply a Python script, and file -i main_app.py
returning the correct MIME type text/x-script.python
, the icon shown in the Nautilus is not that of a Python script and the MIME type reported by the "Properties" tab is text/x-qml
.
Screenshot 1
What is more puzzling is that, checking the /etc/mime.types
file, there is no entry for text/x-qml
! Screenshot 2
After playing around with the file a bit, I found out that this behavior depends really on the contents of the file. My first non-comment lines are
from custom_parser import Parser
import html
import json
from PyQt5 import Qt, QtCore
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
import sys
If I remove all imports of PyQt5 libraries, Nautilus reports the correct icon and MIME type.
One last important (maybe) thing: I had Qt Designer installed earlier on my PC (via sudo apt install qttools5-dev qttools5-dev-tools
), but then removed it with apt
in the same way. I'm running Ubuntu 22.04.2 and Python 3.10.
Therefore, my question is: how can I prevent Nautilus from changing MIME type in this fashion? I don't need support for this extra text/x-qml
MIME type, so it would be fine if I could just delete it from some configuration file.