I had some django test code that used to work in python 2 but started throwing some errors in python3. Here's a snippet:
def test_filter(self):
c1 = dt.Client()
c1.login(username='user1', password='pass')
f = open('data/tiny.txt', 'rb')
test_file = {
'datafile': f,
'uid': 'bb',
'private': 'True',
'name': "tr1"
}
response = c1.post(
'/api/v1/files',
test_file,
format='multipart'
)
When I run this using python3 I get the following Exception:
Exception ignored in: <bound method _TemporaryFileCloser.__del__ of <tempfile._TemporaryFileCloser object at 0x115904160>>
Traceback (most recent call last):
File "/Users/pete/miniconda3/envs/cenv3/lib/python3.6/tempfile.py", line 450, in __del__
self.close()
File "/Users/pete/miniconda3/envs/cenv3/lib/python3.6/tempfile.py", line 446, in close
unlink(self.name)
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/yb/3jwdnlf17gd1dcq65th786d00000gn/T/tmpw_t0j9bw.upload'
Interestingly, this exception doesn't affect the outcome of the tests. They still pass. It does get reported in the output and is rather annoying.
Any ideas on what's causing this? Creating the object with a file using Object.create works fine and doesn't throw an error.