The "tempdir" variable of the Python standard module "tempfile" gets set by PSP:
PSP/ServletWriter.py:43: tempfile.tempdir=os.path.dirname(self._pyfilename) Consequently, when I use mktemp() in my own code, my temporary files land in .../Cache/PSP/ rather than something like ~/tmp or /tmp like I would expect. Furthermore, they seem to disappear on me, e.g., I get "IOError: [Errno 2] No such file or directory" at some point when trying to open them. I think that happens after I restart the app server, but it shouldn't happen at all. Since tempfile.tempdir is shared by the entire process, I think PSP has to relinquish and avoid setting it. Unfortunately, I don't see an optional arg to mktemp() for passing this on invocations: http://python.org/doc/current/lib/module-tempfile.html My suggestion is that we copy the mktemp() to MiscUtils.Funcs and add that argument: tempfile.py: import tempfile def mktemp(suffix="", dir=None): """User-callable function to return a unique temporary file name.""" if not dir: dir = tempfile.gettempdir() pre = tempfile.gettempprefix() while 1: i = tempfile._counter.get_next() file = os.path.join(dir, pre + str(i) + suffix) if not os.path.exists(file): return file Then in PSPServletWriter, this: self._pyfilename = ctxt.getPythonFileName() tempfile.tempdir=os.path.dirname(self._pyfilename) self._temp = tempfile.mktemp('tmp') becomes: self._temp = mktemp('tmp', dir=os.path.dirname(self._pyfilename)) Any comments? -Chuck ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Webware-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-devel