You are not logged in.
Here's the thing, I'm learning Python (but I think my problem extends to any interpreted language). And with that, I already understood that the first line should be:
#!/usr/bin/env python
print('...')
x=int(input())With that, when I run my program through the console it works perfectly.
However, I would like to be able to run it through the graphical interface
(1) Right click > run as program
Searching the internet, I saw that I would need to adapt the first line to:
#!/usr/bin/env -S python './test3.py'
print('...')
x=int(input())However, this only works when I install gnome-terminal.
Therefore, I would like to know if anyone has any idea what I should do to achieve the desired effect (1) using only the console that comes by default in Arch, without having to install gnome-terminal.
*Besides being a beginner in programming, I am also a beginner in English, so I used google translator, but I hope my problem is clear.
Last edited by hat@ke73 (2023-02-19 17:06:14)
Offline
The altered shebang is nonsense and running scripts has principally nothing to do w/ terminal emulators.
The problem is the desktop service you're using to trigger the script from the rmb menu.
It'll have a "Terminal=true" line and that uses the default terminal of your environment (arch does not have something like a default terminal emulator or anything "default" and there's no xdg spec for this either)
=> What's your desktop environment and from which process do you invoke the rmb menu?
Online
Here are some of the outputs of neofetch:
OS: Arch Linux x86_64
Kernel: 6.1.12-arch1-1
shell: bash 5.1.16
FROM: GNOME 43.3
WM: Mutter
WM Theme: Adwaita
Theme: Adwaita-dark [GTK2/3]
Icons: Adwaita [GTK2/3]
terminal: kgx
About the process is literally: right click and choose run as a program.
Offline
No, what program do you use where you right-click.
I guess it's nautilus and you want to use gnome-console as default TE.
From what I can find, gnome (now) hardcodes this to gnome-terminal and you'll have to symlink /usr/bin/gnome-terminal to /usr/bin/kgx which, as everything gnome, is murky as hell.
https://gitlab.gnome.org/GNOME/glib/-/issues/338
Apparently they intend to add an xdg-terminal-exec to glib (which is batshit, because gnome doesn't control xdg, but hey…), but that will require glib2 2.76 - so later this year.
Online
About the process is literally: right click and choose run as a program.
Right click in / on what? On an icon on a desktop? If so the desktop manager would be the relevant process. Or in a file manager? In which case knowing which file manager would be important.
(edit: cross posted w/ the above post)
Last edited by Trilby (2023-02-19 16:08:57)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
No, what program do you use where you right-click.
I guess it's nautilus and you want to use gnome-console as default TE.From what I can find, gnome (now) hardcodes this to gnome-terminal and you'll have to symlink /usr/bin/gnome-terminal to /usr/bin/kgx which, as everything gnome, is murky as hell.
https://gitlab.gnome.org/GNOME/glib/-/issues/338Apparently they intend to add an xdg-terminal-exec to glib (which is batshit, because gnome doesn't control xdg, but hey…), but that will require glib2 2.76 - so later this year.
Worked perfectly! That's exactly what I wanted. Thank you very much "seth"!!
Now, I'm going to do some research on how to make the console close automatically when the program finishes executing.
![]()
Last edited by hat@ke73 (2023-02-19 16:56:16)
Offline
hat@ke73 wrote:About the process is literally: right click and choose run as a program.
Right click in / on what? On an icon on a desktop? If so the desktop manager would be the relevant process. Or in a file manager? In which case knowing which file manager would be important.
(edit: cross posted w/ the above post)
In the case I click with the right button through the nautilus file manager.
Offline