On Monday 26 April 2004 14:57, Angus Leeming wrote: > > Jose'> What does "python -V" says? > > > > riemann: python -V > > Python 2.3.2 > > Jose, note that mkstemp here is my own wrapper function. I wrote it > to allow me to use tempfile.mkstemp in Python 2.3 and tempfile.mktemp > in earlier versions. I may well have got the tempfile.mkstemp API > wrong as I'm using Python 2.2.
Yes, that is the problem: ... mkstemp(suffix='', prefix='tmp', dir=None, text=False) mkstemp([suffix, [prefix, [dir, [text]]]]) User-callable function to create and return a unique temporary file. The return value is a pair (fd, name) where fd is the file descriptor returned by os.open, and name is the filename. This is the help text from 2.3 version of mkstemp, notice that this function returns a file descriptor, as in the C case this is an integer. > tmp, tmp_name = mkstemp() > > success = 0 > for line in open(latex_file, 'r').readlines(): > match = use_preview_re.match(line) > if match == None: > tmp.write(line) > continue I will write a replacement for this using TemporaryFile that is available since 2.0 and it says that "The file is created in the most secure manner available in the appropriate temporary directory for the host platform." In the special case of 2.3 the mkstemp is used, so no need to wrap it. :-) I will submit a patch for this soon... -- José Abílio LyX and docbook, a perfect match. :-)