Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: os.environ does not return Path object #2932

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@
# 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 @@

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
Loading