Desktop icon to run python3 posenet problem (C ok)

Hi,

I am trying to make an icon to run the posenet from dusty nv
For the desktop icon creation, I follow this link,

When I double click the icon, nothing happen, but for c-code posenet, it works… May I know how I can solve it? Thx

[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Icon=/home/nvidia/icon.png
Exec=python3 /home/nvidia/jetson-inference/build/aarch64/bin/posenet.py /dev/video1
Path=/home/nvidia/jetson-inference/build/aarch64/bin/
Name=posenet
StartupNotify=true

But if I change to call posenet c code, it works though

[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Icon=/home/nvidia/icon.png
Exec=posenet /dev/video1
Name=posenet
StartupNotify=true

If I call a simple python code, the icon also works. What makes the posenet.py special? Thx

#!/usr/bin/python3
for _ in range(100000):
    print("Test")

And if I make a shell script (test5.sh) and run it in the terminal, it runs. But if I call this shell script through the icon click, nothing happens…

#!/bin/sh
cd Desktop/client
python3 posenet.py /dev/video1
Version=1.0
Type=Application
Terminal=true
Icon=/home/nvidia/icon.png
Exec=sh  /home/nvidia/test5.sh
Path=/home/nvidia/
Name=posenet
StartupNotify=true

Just a wild guess based on Linux environments, I have not tried this specific use-case. I see you using program names without a path. Try naming anything without a path to the full path.

The command “which” might be useful. If on command line you would run something with “python ...something”, then check with “which python”. Then use that full path in the icon.

Hi, I am not around a Jetson board right now…
I have this suspicion before, that’s why I tried a simple python with print only, the “icon click” works. So, it is not the python3 path issue I think.
And I have created a shell script to run the posenet.py, it works in the terminal but not from the icon click. But the shell script works if I call the posenet c code.
That’s puzzled me… >_<
Thanks,

Hi,

My ultimate goal is to use “node-red” to call a terminal node to ssh remote starting a posenet.py and rtsp stream back the output video.

Thanks,

I’m not a python guy, but there is more you might examine: The printenv output when run in the working case, and again when run via icon…see what differs.

posenet.py should also be installed to /usr/local/bin (like the C++ posenet binary), so can you also try just running posenet.py the same way like you did the C++ version?

It should automatically be run with python3 because of this line in the script, so you shouldn’t have to specify that:
https://github.com/dusty-nv/jetson-inference/blob/01a395892ecc8acdbec4d8e9d6e8ac676416a507/python/examples/posenet.py#L1

Hi,

It should work but it doesn’t… I have made a video to illustrate the problem, pls take a look.
Mmm… I installed the jetson-inference in home. Do I have to install another one in /usr/local/bin? But if I run the python3 posenet.py /dev/video1 in terminal, it works, do you think it is related to the path?

Thanks

If you did sudo make install from your ~/jetson-inference/build directory, then the binaries will get installed to /usr/local/bin. In that sense, it doesn’t matter where you cloned your source tree to.

Hi,
I am still trying to find a solution.
Plan B, I just put the shell script in the Desktop, when I double click it, it is opened in Vim.
I follow this link, but the Jetson Desktop is different from typical Ubuntu…

So, I right click and in Permission tab, I check “Allow executing files as program”.
In “Open with” tab, I choose “Run Software”. But when I double check the script, it does nothing.
I did try “Shell extensions” but it pops a windows about shell extension which seems wrong too…

BTW, I did try the shell script in the terminal under Desktop directory, it works. So, it is not the shell script problem.
And I have done the script chmod 777 (Just in case)

Finally, it is working. :> Thx everyone.

I found the solution in here, launcher - How to execute a script just by double clicking like .EXE files in Windows? - Ask Ubuntu
in the desktop, use this instead

Exec=gnome-terminal -e "bash -c './script.sh;$SHELL'"

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.