Author Oleg Babintsev
Recipients Hans Lawrenz, Oleg Babintsev, abarry, bkabrda, martin.panter, pitrou, python-dev, serhiy.storchaka, vstinner
Date 2016-06-18.10:35:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1466246139.27.0.206284878089.issue25717@psf.upfronthosting.co.za>
In-reply-to
Content
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:

0e87f2561643">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'

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

0e87f2561643">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]'
>>>
History
Date User Action Args
2016-06-18 10:35:39Oleg Babintsevsetrecipients: + Oleg Babintsev, pitrou, vstinner, python-dev, martin.panter, serhiy.storchaka, bkabrda, abarry, Hans Lawrenz
2016-06-18 10:35:39Oleg Babintsevsetmessageid: <1466246139.27.0.206284878089.issue25717@psf.upfronthosting.co.za>
2016-06-18 10:35:39Oleg Babintsevlinkissue25717 messages
2016-06-18 10:35:38Oleg Babintsevcreate