Skip to content

Commit

Permalink
BUG: os.environ does not return Path object
Browse files Browse the repository at this point in the history
  • Loading branch information
pllim committed Jul 1, 2024
1 parent c7efcad commit 8771217
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions jdaviz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,6 @@ def download_uri_to_path(possible_uri, cache=None, local_path=os.curdir, timeout
local path to the downloaded file.
"""

if os.environ.get("JDAVIZ_START_DIR", ""):
# avoiding creating local paths in a tmp dir when in standalone:
local_path = os.environ["JDAVIZ_START_DIR"] / local_path

if not isinstance(possible_uri, str):
# only try to parse strings:
return possible_uri
Expand All @@ -541,6 +537,10 @@ def download_uri_to_path(possible_uri, cache=None, local_path=os.curdir, timeout
# don't try to parse file paths:
return possible_uri

if os.environ.get("JDAVIZ_START_DIR", ""):
# avoiding creating local paths in a tmp dir when in standalone:
local_path = os.path.join(os.environ["JDAVIZ_START_DIR"], local_path)

Check warning on line 542 in jdaviz/utils.py

View check run for this annotation

Codecov / codecov/patch

jdaviz/utils.py#L542

Added line #L542 was not covered by tests

parsed_uri = urlparse(possible_uri)

cache_none_msg = (
Expand Down Expand Up @@ -588,7 +588,7 @@ def download_uri_to_path(possible_uri, cache=None, local_path=os.curdir, timeout

if local_path is None:
# if not specified, this is the default location:
# os.path.sep does not work because on windows that is a back slash
# os.path.sep does not work because on Windows that is a back slash
# and this web path needs to be split with a forward slash
local_path = os.path.join(os.getcwd(), parsed_uri.path.split('/')[-1])
return local_path
Expand Down

0 comments on commit 8771217

Please sign in to comment.