Reputation: 5836
I am using os.environ
to include a path using
os.environ['PATH'] += os.pathsep + bin_path
In the bin_path
, there is a executable ping
. However, doing a shutil.which(ping)
shows that ping
has been picked up from a different location. How to enforce that ping
accessed is the one from bin_path
?
Upvotes: 0
Views: 63
Reputation: 780724
PATH
is searched in order. If you want your directory to take precedence, you need to put it at the beginning, not the end.
os.environ['PATH'] = bin_path + os.pathsep + os.environ['PATH']
Upvotes: 1