Waldek M. wrote: > On Fri, 09 Sep 2011 23:03:10 +1000, Steven D'Aprano wrote: >> But think carefully before doing this. Some functions may be confused if >> you change directories while they are running. You may be better off >> staying in the same directory, and adjusting the path names to the files >> as you work with them. > > Curious. > Do you mean multi-threaded environment or even in single thread? > If the latter is the case, I'd say those functions make > very nasty assumptions. Who are they, anyways? ;)
The main one that comes to mind is os.walk, which has this to say: Caution: if you pass a relative pathname for top, don't change the current working directory between resumptions of walk. walk never changes the current directory, and assumes that the client doesn't either. Seems like a reasonable assumption to me. -- Steven -- http://mail.python.org/mailman/listinfo/python-list