Closed
Description
Hi all
I caught this hidden exception with this code while using your nice library:
from fs import tarfs
tarfs.TarFS('tar://i_do_not_exist.tar')
Above code will trigger the following ignored exception:
Exception ignored in: <function FS.__del__ at 0x108b2b950>
Traceback (most recent call last):
File "/Users/jaska/github/moremoban/pyfilesystem2/fs/base.py", line 117, in __del__
self.close()
File "/Users/jaska/github/moremoban/pyfilesystem2/fs/tarfs.py", line 465, in close
self._tar.close()
AttributeError: 'ReadTarFS' object has no attribute '_tar'
======================================================================
FAIL: test_read_non_existent_file (tests.test_tarfs.TestReadTarFS)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/jaska/github/moremoban/pyfilesystem2/fs/errors.py", line 130, in new_func
return func(*args, **kwargs)
File "/Users/jaska/github/moremoban/pyfilesystem2/fs/tarfs.py", line 272, in __init__
self._tar = tarfile.open(file, mode="r")
FileNotFoundError: [Errno 2] No such file or directory: 'tar://i_do_not_exist.tar'
The same applies for ZipFS. I will send one PR over.