[Tutor] set current working dir
Dave Angel
davea at davea.name
Tue Mar 17 11:33:49 CET 2015
On 03/16/2015 02:29 PM, Rajbir Singh wrote:
> i need to know how i can set current working dir in an executing phython
> using os module
os.chdir() will change the current directory, but it changes it for the
whole program (all threads), and the change lasts till the program
terminates.
Very often, one of these "buts" is a problem, so most people prefer to
find a different way of solving the problem. I prefer to have a policy
of never changing the current directory once started, and for all file
names make them either relative to that original current directory, or
just make them absolute.
There are a number of functions that let you manipulate the file name
strings, mostly in os.path
--
DaveA
More information about the Tutor
mailing list