Author Hans Lawrenz
Recipients Hans Lawrenz
Date 2015-11-24.04:23:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1448339024.55.0.65158482353.issue25717@psf.upfronthosting.co.za>
In-reply-to
Content
Inside a virtualbox vm, calling tempfile.TemporaryFile(dir=foo) where foo is a directory which resides on a volume mounted from the host OS, a FileNotFoundError exception is thrown.

In the following code sample, the second block will print "Path 2: ERROR" on Python 3.5 but not on 3.4 or 2.7 (assuming the vagrant environment provided below):

import tempfile


try:
    with tempfile.TemporaryFile() as tf:
        tf.write("testing testing testing\n".encode('utf-8'))
    print("Path 1: worked")
except FileNotFoundError as e:
    print("Path 1: ERROR")

try:
    with tempfile.TemporaryFile(dir="/vagrant") as tf:
        tf.write("testing testing testing\n".encode('utf-8'))
    print("Path 2: worked")
except FileNotFoundError as e:
    print("Path 2: ERROR")


A runnable test case can be found here:
https://github.com/hlawrenz/py35tempfiletest
History
Date User Action Args
2015-11-24 04:23:44Hans Lawrenzsetrecipients: + Hans Lawrenz
2015-11-24 04:23:44Hans Lawrenzsetmessageid: <1448339024.55.0.65158482353.issue25717@psf.upfronthosting.co.za>
2015-11-24 04:23:44Hans Lawrenzlinkissue25717 messages
2015-11-24 04:23:43Hans Lawrenzcreate