looping wrote:

> On Oct 31, 2:16 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> 
>> I'm not an expert, but I think you need to close the file first - you
>> under windows here, which can be picky about such stuff AFAIK. Or maybe
>> there is some other mode-specifier.
>>
>> Diez
> 
> Actually closing the file delete it without any chance to use it...
> 
> Well I changed my code this way:
> 
> filename = tempfile.mktemp(suffix='.sql')
> f = open(filename, 'wb')
> try:
>     f.write(txt.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 of temporary file (as explained in
> Python doc) but maybe standard lib need a NamedTemporaryFile that
> could be used by another process.

As I said: that most likely is a limitation of your operating system, not
Python.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to