Editing the PATH environment variable
I am running PyCharm 2017.2.3 on Ubuntu 16.04, and I have a shell script located at "/path/to/script.sh". I have added some code to a Python script which will call this shell script, which required me to at the line "PATH=$PATH:/path/to$ to my .bashrc file. Running the Python script from a terminal then behaves as expected, and calls the shell script without any problem.
However, what if I want to run the Python script from within PyCharm? To do this, I have tried editing "Environment variables" in "Settings->Build, Execution, Deployment->Console->Python Console". Here, I entered "PATH" under the "Name" column, and "/path/to" under the "Value" column. However, after running the Python script from within PyCharm, I receive an error: "FileNotFoundError: [Errrno 2] No such file or directory: 'script.sh'. This was the same error that occurred before I edited my .bashrc file, when running the Python script from the terminal.
So it seems that, despite telling PyCharm that the PATH variable should include the directory containing the shell script, it is not able to find this shell script. What is the solution?
Please sign in to leave a comment.