Adding a Path to a Shell

I am trying to run some Python code using a Shell in a Xojo project… It all works fine from a Terminal window but the default Path provided in the Shell does not find all the required Libs… so I assume I need to add some Paths to the Shell environment.

Shell1 has been placed on the app’s main Window… and I run the following code:

// just to see what the current Path is
cmd = “echo $PATH”
// as I would expect this returns the default Shell path… /usr/bin:/bin:/usr/sbin:/sbin

// try to add “/Users/test/test_folder” to the Path
cmd = “export PATH=/Users/test/test_folder:$PATH”
Shell1.Execute(cmd) // returns blank result with no error

// to see if the last command worked
cmd = “echo $PATH”
// returns the default and not my “export” path

Any idea what I am doing wrong?

Replace “:” with “/”
Plus, “export PATH=/Users/test/test_folder”+"/"+$PATH

$PATH outside of the string quote to add its value instead of the variable name.

In Synchronous and Asynchronous modes, each call to Execute starts a new shell. It would be equivalent of running the “export” command in Terminal, closing that window, opening a new one, then running “echo $PATH”.

Try executing this:

cmd = "PATH='123' echo $PATH"
Shell1.Execute( cmd )

Kem… thanks… I guess I thought that if I used the same instance of the shell it would be the same shell.