Page 1 of 1
Launch and External Application
Posted: Thursday 15th July 2021 4:04am
by sarpomira
Hi All,
I am having trouble finding the method to launch an external python application.
In the attempt below, I get a "File or directory does not exist " error.
The App.py resides on my Desktop and is definitely in the path I provided.
I wish to launch it in the linux teminal shell.
BUTTON:
Public Sub cmdExec_Click()
Exec ["home/robert/Desktop/App.py"]
End
Any guidance would be appreciated.
Cheers
Re: Launch and External Application
Posted: Thursday 15th July 2021 5:03am
by Quincunxian
Hi sarpomira,
You may be able to get
xdg-open to work for this.
xdg-open will find the correct application to open the file appended to the command.
I use the subroutine below in a module to globally open things like text, html, {office documents} ect.
If you have the appropriate applications installed and registered correctly then it should open any associated file.
Public Sub OpenDocument(InPath As String)
Exec ["xdg-open", InPath]
End
The xdg family of utilities are quite good and are on 'most' linux installs.
Re: Launch and External Application
Posted: Thursday 15th July 2021 10:52am
by BruceSteers
sarpomira wrote: ↑Thursday 15th July 2021 4:04am
Hi All,
I am having trouble finding the method to launch an external python application.
In the attempt below, I get a "File or directory does not exist " error.
The App.py resides on my Desktop and is definitely in the path I provided.
I wish to launch it in the linux teminal shell.
BUTTON:
Public Sub cmdExec_Click()
Exec ["home/robert/Desktop/App.py"]
End
Any guidance would be appreciated.
Cheers
you have no / at the beginning of the path...
try this..
Public Sub cmdExec_Click()
Exec ["/home/robert/Desktop/App.py"]
End
Re: Launch and External Application
Posted: Thursday 15th July 2021 12:56pm
by cogier
Gambas has the tools to do this. You need to add the
gb.desktop component for this solution.
''Requires the gb.desktop component
Public Sub cmdExec_Click()
Desktop.Open(User.Home &/ "Desktop/App.py", True)
End
See the help
HERE.
Re: Launch and External Application
Posted: Thursday 15th July 2021 1:41pm
by sarpomira
Thank you all !
This worked for me.
''Requires the gb.desktop component
Public Sub cmdExec_Click()
Desktop.Open(User.Home &/ "Desktop/App.py", True)
End
Cheers !