[issue25717] tempfile.TemporaryFile fails when dir option set to directory residing on host OS mount

Hans Lawrenz report at bugs.python.org
Tue Nov 24 01:54:31 EST 2015


Hans Lawrenz added the comment:

Host OS: Mac OS 10.11.1
Guest OS: Ubuntu Trusty 64
Virtualbox: 4.3.30
Vagrant: 1.7.4


Example with trace thrown:

vagrant at vagrant-ubuntu-trusty-64:/vagrant$ cat tt.py 
import tempfile


with tempfile.TemporaryFile(dir="/vagrant") as tf:
    tf.write("testing testing testing\n".encode('utf-8'))

vagrant at vagrant-ubuntu-trusty-64:/vagrant$ python3.5 tt.py 
Traceback (most recent call last):
  File "tt.py", line 4, in <module>
    with tempfile.TemporaryFile(dir="/vagrant") as tf:
  File "/usr/lib/python3.5/tempfile.py", line 753, in TemporaryFile
    newline=newline, encoding=encoding)
FileNotFoundError: [Errno 2] No such file or directory


I think the underlying system call that's causing the error (I attached the full strace in case that's helpful):
open("/vagrant", O_RDWR|O_EXCL|O_DIRECTORY|O_NOFOLLOW|O_CLOEXEC|0x400000) = -1 EOPNOTSUPP (Operation not supported)

Finally, the mount point looks like this:
vagrant on /vagrant type vboxsf (uid=1000,gid=1000,rw)

----------
Added file: http://bugs.python.org/file41145/tempfile-strace.txt

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25717>
_______________________________________


More information about the Python-bugs-list mailing list