Skip to content

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

@kyleabeauchamp

Description

@kyleabeauchamp

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions