Path question
R C
cjvijf at gmail.com
Mon Oct 19 03:39:05 UTC 2020
might be a little late, but just saw this.
Why don't you set the working/current directory in your script? That way
you can execute it from "anywhere", and it sets it's own current
directory to where ever you want it, without having to do all kinds of
trickery with environment variables. Any language has a way to do that.
Ron
On 10/11/20 10:40 PM, Phil wrote:
> This seemingly simple operation has me scratching my head.
>
> I have a python script that I want to add to the system menu. I cannot
> run "python3 /path_to_the_script/thescript" outside of it's directory
> because "thescript" needs resources that are also in that directory.
> Of course, "thescript" will run from it's own directory
> (/home/phil/Downloads/Ink_spill).
>
> In an attempt to solves this problem I've added the directory to the
> path but there's something odd going on here, as follows:
>
> phil at phil-ThinkPad-T420:~$ cat $PATH
> cat:
> '/home/phil/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/phil/Downloads/Ink_spill':
> No such file or directory
>
> phil at phil-ThinkPad-T420:~$ cd /home/phil/Downloads/Ink_spill
>
> pwd
>
> phil at phil-ThinkPad-T420:~/Downloads/Ink_spill
>
> cat $PATH indicates the directory doesn't exist but it does. What's
> going on?
>
More information about the ubuntu-users
mailing list