AdaCore / gnatstudio

GNAT Studio is a powerful and lightweight IDE for Ada and SPARK.
416 stars 54 forks source link

Python doesn't always read the PATH variable correctly #142

Closed Joebeazelman closed 1 year ago

Joebeazelman commented 1 year ago

I'm writing a Gnat Studio plugin and I need to locate another executable. I'm using Python's shell utilities to issue a which command returns none. It works from my OS terminal and from Gnat Studio's terminal window.

I found the reason, but don't have a solution. When I peek into the interpreter's environment variables, some of my PATH directories I exported in my .zsh file are not included. I tried to restart Gnat Studio without success. It's unclear how the Python interpreter reads the PATH.

AnthonyLeonardoGracio commented 1 year ago

Hello @Joebeazelman,

You can use the locate_exec_on_path function present in our os_utils.py python package for that purpose. It will work from your Python plugin if the executable you are looking for is present in your PATH before launching GNAT Studio.

Regards,