Oleg Babintsev added the comment:

My environment: 
Windows as host OS, VirtualBox VM, Linux as guest OS

When temporary directory is a directory which mounted from the host OS, a 
"OSError: [Errno 26] Text file busy" exception is thrown.

Test file:

import tempfile

with tempfile.TemporaryFile(dir="/tmp") as tf:
    tf.write("testing testing testing\n".encode('utf-8'))
print("Temp file: worked")

"/tmp" directory - is a shared folder (vboxsf)

Result:

root@0e87f2561643:/# python /etc/odoo/tempfile-test.py
Traceback (most recent call last):
  File "/etc/odoo/tempfile-test.py", line 3, in <module>
    with tempfile.TemporaryFile(dir="/tmp") as tf:
  File "/usr/lib/python2.7/tempfile.py", line 513, in TemporaryFile
    _os.unlink(name)
OSError: [Errno 26] Text file busy: '/tmp/tmpsl0JQI'

root@0e87f2561643:/# python --version
Python 2.7.11+

root@0e87f2561643:/# python
Python 2.7.11+ (default, Jun  2 2016, 19:34:15)
[GCC 5.3.1 20160528] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version
'2.7.11+ (default, Jun  2 2016, 19:34:15) \n[GCC 5.3.1 20160528]'
>>>

----------

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

Reply via email to