Need to add this path --> /home/ubuntu/folderA to my PATH environment variable in linux ubuntu.
Update
print(os.environ["PATH"])
path = "/home/ubuntu/folderA"
os.environ["PATH"] += os.pathsep + path
print(os.environ["PATH"])
#Can see the newly added path here when i print
However, i am still unable to access the path.
And when i do printenv
, i still do not see the path.
Tried os.getenv("PATH")
to see if path has been updated but it is still the same thing
If i do it manually using the following command, then useprintenv
, the path is there.
export PATH=$PATH:/home/ubuntu/folderA
What I need is to update the path using the first method in my python script then carry on which the rest of my methods.
Hopefully someone can take a look. Thank you.
Final update: Turns out the path is appended when i run my python script. Just that after the script is completed, the path will not persist. Hence when i do printenv
, the path is not showing up.