Re: duplicate temporary file?

2010-05-03 Thread Christian Heimes
Laszlo Nagy wrote: However, it won't work for temporary files. Temporary files are just file-like objects, and their name is ''. I guess I could open a temporary file with os.open, and then use os.dup, but that is low level stuff. Then I have to use os.* methods, and the file

duplicate temporary file?

2010-05-03 Thread Laszlo Nagy
ot;rb") self.fin.seek(file_object.tell()) ... However, it won't work for temporary files. Temporary files are just file-like objects, and their name is ''. I guess I could open a temporary file with os.open, and then use os.dup, but that is low level stuff. Then I have to use o

Re: Temporary file

2009-04-09 Thread Dave Angel
aditya shukla wrote: I am trying to create a temporary file. import tempfile temp = tempfile.NamedTemporaryFile(suffix='_suffix', prefix='prefix_', dir='/tmp',

Re: Temporary file

2009-04-09 Thread MRAB
aditya shukla wrote: I am trying to create a temporary file. import tempfile temp = tempfile.NamedTemporaryFile(suffix='_suffix', prefix='prefix_', dir='/tmp',

Temporary file

2009-04-09 Thread aditya shukla
I am trying to create a temporary file. import tempfile temp = tempfile.NamedTemporaryFile(suffix='_suffix', prefix='prefix_', dir='/tmp', ) try: print 

Re: fork after creating temporary file using NamedTemporaryFile

2008-07-16 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Sebastian "lunar" Wiesner wrote: > Relying on the destructor is *always* a bad idea, you should always > close files explicitly! There shouldn't be any problem with files opened read-only. -- http://mail.python.org/mailman/listinfo/python-list

Re: fork after creating temporary file using NamedTemporaryFile

2008-07-15 Thread Sebastian "lunar" Wiesner
[EMAIL PROTECTED] <[EMAIL PROTECTED]>: > When I create temporary file using the tempfile module, and forkI) > later on in my program, I always see errors when the program exits. Is > this because the child process deletes temp file? > Here's a stripped down version of my sc

fork after creating temporary file using NamedTemporaryFile

2008-07-15 Thread rparimi
Hello pythoners, When I create temporary file using the tempfile module, and forkI) later on in my program, I always see errors when the program exits. Is this because the child process deletes temp file? Here's a stripped down version of my script that exhibits this problem: #!/usr/bin/p

Re: Creating a temporary file in Python

2007-10-31 Thread looping
On Oct 31, 2:16 pm, Sion Arrowsmith <[EMAIL PROTECTED]> wrote: > " [ ... ] Whether the name can be used to open the file a second time, > while the named temporary file is still open, varies across platforms > (it can be so used on Unix; it cannot on Windows NT or later).&qu

Re: Creating a temporary file in Python

2007-10-31 Thread Sion Arrowsmith
looping <[EMAIL PROTECTED]> wrote: >I want to create a temporary file, read it in an external command and >finally delete it (in Windows XP). > >I try to use tempfile module but it doesn't work, the file couldn't be >open by my other process (error like: SP2-0310: u

Re: Creating a temporary file in Python

2007-10-31 Thread Diez B. Roggisch
t.encode('cp1252')) > f.close() > p = Popen([SQL_PLUS, '-s', dsn, > '@', SQL_PLUS_SCRIPT, f.name], > stdout=PIPE, stderr=STDOUT) > p.wait() > finally: > os.remove(filename) > > I understand the security issues

Re: Creating a temporary file in Python

2007-10-31 Thread looping
n, '@', SQL_PLUS_SCRIPT, f.name], stdout=PIPE, stderr=STDOUT) p.wait() finally: os.remove(filename) I understand the security issues of temporary file (as explained in Python doc) but maybe standard lib need a NamedTemporaryFile that could be used by another process. -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating a temporary file in Python

2007-10-31 Thread Diez B. Roggisch
looping wrote: > Hi, > > I want to create a temporary file, read it in an external command and > finally delete it (in Windows XP). > > I try to use tempfile module but it doesn't work, the file couldn't be > open by my other process (error like: SP2-0310: unab

Creating a temporary file in Python

2007-10-31 Thread looping
Hi, I want to create a temporary file, read it in an external command and finally delete it (in Windows XP). I try to use tempfile module but it doesn't work, the file couldn't be open by my other process (error like: SP2-0310: unable to open file "c: \docume~1\looping\locals

Re: Best way to create temporary file?

2005-05-02 Thread Frank Millman
Ok, thanks for the advice. Frank -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to create temporary file?

2005-05-01 Thread Michael Hoffman
Frank Millman wrote: > It is certainly possible to store the entire report in memory, using a > two-dimensional list (page/line), but if a report runs into hundreds of > pages, I am concerned at the amount of memory this would require. > Perhaps I am being old-fashioned - with todays memory of at

Re: Best way to create temporary file?

2005-05-01 Thread Frank Millman
Frank Millman wrote: > > Hi all > > > > I need to generate potentially large reports from a database, and I > > want to offer the option of print preview before actually printing > > (using wxPython). I figure that the best way to achieve this is to > > writ

Re: Best way to create temporary file?

2005-04-29 Thread Fabio Pliger
at the best way to achieve this is to > write the report to a temporary file, or more likely to a temporary > directory with a separate file for each page. I can use that for > previewing and for printing, and then delete the file/directory. > > There seems to be a few ways to ach

Best way to create temporary file?

2005-04-29 Thread Frank Millman
Hi all I need to generate potentially large reports from a database, and I want to offer the option of print preview before actually printing (using wxPython). I figure that the best way to achieve this is to write the report to a temporary file, or more likely to a temporary directory with a