TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ALL
from: DENNIS LEE BIEBER
date: 2019-11-06 20:34:00
subject: Re: file -i vs xdg-mime q

On Wed, 6 Nov 2019 20:40:34 +0100, "R.Wieser" 
declaimed the following:

>
>The file I have archived has a date of 27 september.
>
>> while the full NOOBS is September 30
>
>Hmmm...  Mine is a full version (I don't like to depend on other people
>keeping stuff available for me), which than should not be possible.
>

 Looks like you downloaded it a few days /before/ 3.2.1 went on-line.

>
>That only helps when it can figure out what to execute it with.  AFAIK you
>can set the execute bit on a textfile, but that doesn't cause it to
>bexecuted by ... something.
>
>> And typing ./test1.py in a console does execute it.
>
>Which makes me suspect that the console and the desktop use different
>methods to figure out what kind of file they are dealing with (and thus
>which program they should start it with).
>

 Console probably relies upon "file" and mailcap -- and that uses a
number of different methods. The infamous "magic number" being one (a
shebang being one of those "magic numbers"). It may also have a database of
common file extensions, or some regular expression parsing of the first few
lines of a file.

>> Thonny seems to be the foundation's preferred Python IDE (ignoring
>> IDLE -- as I always do ).
>
>The desktops "programming" group shows both thonny as well as mu. No hint of
>IDLE (if that is a programs name).  And files with the pyton3 shebang are
>coupled to mu, not thonny (have to figure out how to change that some day
>too).
>
 IDLE is a Python script that uses Tkinter (Python interface to TCL/Tk)
for GUI.

 Interesting... It looks like Raspbian includes IDLE for Python 2.7 but
not 3.x -- yet there are .desktop files for the latter (which try to invoke
/usr/bin/idle-python3.7 -- and that does not exist).

pi@rpi3bplus-1:~$ sudo find / -iname "idle*"

/usr/lib/pypy/lib-python/2.7/idlelib

/usr/lib/pypy/lib-python/2.7/idlelib/idle.py

/usr/share/raspi-ui-overrides/applications/idle-python3.7.desktop
/usr/share/man/man2/idle.2.gz
pi@rpi3bplus-1:~$

 Since I uninstalled mu, I don't have a .desktop file for it; I'll use
the thonny desktop file for the example.

pi@rpi3bplus-1:~$ cat /usr/share/applications/Thonny.desktop
[Desktop Entry]
Type=Application
Name=Thonny Python IDE
GenericName=Python IDE
Exec=/usr/bin/thonny %F
Comment=Python IDE for beginners
Icon=thonny
Terminal=false
Categories=Application;Development;
StartupNotify=true
MimeType=text/x-python;  <======
Actions=Edit;

[Desktop Action Edit]
Exec=/usr/bin/thonny %F
Name=Edit with Thonny
pi@rpi3bplus-1:~$

Look for a mu.desktop (or maybe mu-editor.desktop) and see if it has a
MimeType=text/x-python3; line (since you state it shows for python3 files
but not plain python [2] files). If you have some other editor that you
think should be associated instead, add the python mime type to it... For
example, here is what geany.desktop contains (note: I'm stripping out all
the foreign language lines).

pi@rpi3bplus-1:~$ cat /usr/share/applications/geany.desktop
[Desktop Entry]
Type=Application
Version=1.0
Name=Geany

GenericName=Integrated Development Environment

Comment=A fast and lightweight IDE using GTK+

Exec=geany %F
Icon=geany
Terminal=false
Categories=GTK;Development;IDE;
MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-
java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;appl
ication/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;applicat
ion/xml;text/html;
text/css;text/x-sql;text/x-diff;
StartupNotify=true
Keywords=Text;Editor;

pi@rpi3bplus-1:~$

Note how it has a slew of mime type entries.


--
 Wulfraed                 Dennis Lee Bieber         AF6VN
 wlfraed@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.