John Florian added the comment:

I just stumbled onto this though I'm not writing for Windows.  Instead, I'm on 
Fedora 25 with Python 3.5.2 and I went nearly crazy tracing down what seemed to 
be inconsistent behavior.  My use case has Python using 
NamedTemporaryFile(delete=True) in a CM to produce content fed into a 
subprocess.  The code had been reliably working and then it just didn't.  The 
only thing changing was the content being written, an rendered Jinja2 template. 
 I believe the fate is determined by the content length.  In debugging another 
problem, I'd been trivializing the template and once it got down to about 3k 
(rendered) the subprocess began seeing a file whose length was 0 bytes.  Make 
the template bigger and all works again.  Calling close() resolves the issue, 
but of course requires delete=False which removed much of the value of this 
object.  Preliminary testing looks like flush() may also resolve the issue.

Have I just been naive and getting lucky all along because this is expected or 
is there something else fishy here worth investigation?

----------
nosy: +John Florian

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14243>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to