1

I have a python script (which requires several other python files) in a folder, ~/Desktop/ufonet.

I thought that by making a symlink (I tried both hard and soft) to that folder it would put it in my path.

It didn't work, so I tried making the symlink to the executable.

It worked, but the program inherited the /usr/bin cwd, so it could not find its dependencies.

What is the correct way to do it without passing the cwd?

1
  • @Zanna Sorry, somehow I managed to screw up... it did work after pointing it to the executable, but it "inherited" the current working directory, for that very reason it can't find it's dependencies. Apr 8, 2017 at 20:33

1 Answer 1

1

I would create a simple wrapper script.

If the program is for your use only and you wish to keep it in ~/Desktop/ufonet, then create an executable script

#!/bin/sh
cd $HOME/Desktop/ufonet && ./yourscript

and place it in ~/bin, which is added to your PATH by the default Ubuntu ~/.profile.

If you want to make the program available to other users, do essentially the same thing but place the wrapper in /usr/local/bin. In that case, I'd suggest moving the whole ufonet directory to /usr/local as well, so that the wrapper becomes

#!/bin/sh
cd /usr/local/ufonet && ./yourscript

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .