Skip to content

Commit

Permalink
Merge pull request #2932 from pllim/fix-standalone-no-load
Browse files Browse the repository at this point in the history
BUG: os.environ does not return Path object
  • Loading branch information
pllim authored Jul 2, 2024
2 parents c7efcad + 8771217 commit 0ffae63
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)

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 0ffae63

Please sign in to comment.