counsyl / stor

A cross-compatible CLI and Python API for accessing block and object storage
https://counsyl.github.io/stor/
Other
35 stars 12 forks source link

Import issue with optional dependencies in S3/DX codepath #137

Open kyleabeauchamp opened 4 years ago

kyleabeauchamp commented 4 years ago

I've noticed that if you do a simple pip install stor (version 3.1.0), there are some S3 code paths that raise exceptions due to not-imported optional DX components.

The following is a MWE:

import stor.s3

s3_path = "s3://path_to_thing"

fh = stor.s3.S3Path(s3_path)

fh.open()

When executing this script, the following exception occurs during object destruction:

Exception ignored in: <function OBSFile.__del__ at 0x1069f>
Traceback (most recent call last):
  File "[...]lib/python3.7/site-packages/stor/obs.py", line 401, in __del__
    self.close()
  File "[...]lib/python3.7/site-packages/stor/obs.py", line 457, in close
    self._wait_on_close()
  File "[...]lib/python3.7/site-packages/stor/obs.py", line 460, in _wait_on_close
    if isinstance(self._path, stor.dx.DXPath):
AttributeError: module 'stor' has no attribute 'dx'