[Zope] Change current path in External Method
Dieter Maurer
dieter@handshake.de
Sat, 28 Dec 2002 20:14:09 +0100
Klimovich Alexander wrote at 2002-12-28 15:25 +0200:
> Can anyone tell me how to change system current folder using
> python methods?
> E.g. 'os.getcwd()' returns current folder,
> I need function like 'os.setcwd(path)'?
Do *NOT* do this in a multi-threaded application (such as Zope)!
The current working directory is process global, shared by all
threads.
Think what fine things can happen when it is changed concurrently
by different threads...
When you really need it, you must carefully use locks to prevent
concurrent modification.
But a better way is to prefix the needed path yourself to your
filenames.
Dieter