Message255246
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 |
|
Date |
User |
Action |
Args |
2015-11-24 04:23:44 | Hans Lawrenz | set | recipients:
+ Hans Lawrenz |
2015-11-24 04:23:44 | Hans Lawrenz | set | messageid: <1448339024.55.0.65158482353.issue25717@psf.upfronthosting.co.za> |
2015-11-24 04:23:44 | Hans Lawrenz | link | issue25717 messages |
2015-11-24 04:23:43 | Hans Lawrenz | create | |
|