- Code: Select all
joepal@joepalnx:~/Skrivbord$ mh_phoenix/MH_Phoenix
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'main.py'
Could not run main Python script
joepal@joepalnx:~/Skrivbord$
I see two solutions to this: 1. make the MH_Phoenix binary aware of the fact that it has been run from another directory, or 2. Add a wrapper script.
I've tinkered with the second solution. Save the following to a file called "mh.bash" in the "mh_phoenix" directory, and chmod it 755:
- Code: Select all
#!/bin/bash
CURRDIR=`pwd`
MHDIR=`echo $0 | sed -e "s/\/mh\.bash$//"`
if [ -f MH_Phoenix ]
then
echo "Found MH_Phoenix, no need to CD"
else
echo "Need to CD to find MH_Phoenix"
cd $MHDIR
fi
./MH_Phoenix &> /dev/null
cd $CURRDIR
This way you can run it from somewhere else with an absolute path, eg
- Code: Select all
/usr/bin/local/mh_phoenix/mh.bash
and it will launch correctly.
The reason why this is interesting is because when adding a launcher in for example the ubuntu menu system, the current directory isn't changed to where the binary is, thus resulting in a launch failure. If instead referencing this script in the menus, the application will launch correctly.