Path question
Chris Green
cl at isbd.net
Mon Oct 12 08:16:13 UTC 2020
On Mon, Oct 12, 2020 at 02:40:52PM +1000, 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?
>
The 'cat' command simply tries to open the whole of the string
contained in $PATH as if it was a file. Since there is no file
'/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'
you get the error message.
--
Chris Green
More information about the ubuntu-users
mailing list