0

I have a script that I merged into a single file by using pyinstaller. For the case, let´s do it with a simpler example, since the error also ocurrs:

helloworld.py

#!/bin/bash 
print "Hello World!"

By running pyinstaller --onefile helloworld.py, it creates the dist Folder with the executable file inside (helloworld).

I can run correctly this file on the terminal by typing ./helloworld, but it does not work if a make double-click, or right-click > Run.

Before you are asking, yes, in the properties of the file the Option Allow executing file as program is checked.

Also, in Nautilus, going to Edit > Preferences > Behavior, I already selected the option Ask each time for the Executable Text Files.

I am aware that there are many questions about the same thing, but I have tried everything and I couldn´t solve the problem still. Does anyone know what can be happening? Thanks in advance.

1 Answer 1

1

In fact the file is executed, but running a program from Nautilus doesn't open it in a terminal. The best way to run a software is create a shell desktop entry within /usr/share/applications or ~/.local/share/applications. Desktop with be named something like helloworld.desktop and should contain the following example:

[Desktop Entry]

# The type as listed above
Type=Application

# The version of the desktop entry specification to which this file complies
Version=1.0

# The name of the application
Name=HelloWorld

# A comment which can/will be used as a tooltip
Comment=This is just a sample

# The path to the folder in which the executable is run
Path=/opt/helloworld/

# The executable of the application, possibly with arguments.
Exec=/opt/helloworld/helloworld

# The name of the icon that will be used to display this entry
Icon=/path/to/an/icon.svg

# Describes whether this application needs to be run in a terminal or not
Terminal=true

# Describes the categories in which this entry should be shown
Categories=Misc;Languages;Python;

Source of the information : https://wiki.archlinux.org/index.php/desktop_entries

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.