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

MIssing "direct_url.json" causes JSONDecodeError: Expecting value: line 1 column 1 (char 0) #77

Closed
janosh opened this issue Jan 28, 2024 Discussed in #76 · 0 comments · Fixed by #78
Closed

MIssing "direct_url.json" causes JSONDecodeError: Expecting value: line 1 column 1 (char 0) #77

janosh opened this issue Jan 28, 2024 Discussed in #76 · 0 comments · Fixed by #78
Labels
bug Something isn't working data Data loading and processing pkg PyPI package related

Comments

@janosh
Copy link
Owner

janosh commented Jan 28, 2024

Discussed in #76

Originally posted by Claudia-Hello January 28, 2024
I have run this repository, but there was no "direct_url.json" file in the "matbench-discovery" folder. Could you please tell me how to solve this problem? The source coda can be seen as follows. Thank you so much!

pkg_name = "matbench-discovery"
direct_url = Distribution.from_name(pkg_name).read_text("direct_url.json") or ""
pkg_is_editable = json.loads(direct_url).get("dir_info", {}).get("editable", False)

Full Stacktrace

---> 17 from matbench_discovery import (
     18     PDF_FIGS,
     19     SCRIPTS,
     20     SITE_FIGS,
     21     Key,
     22     ModelType,
     23     Targets,
     24     Task,
     25 )
     26 from matbench_discovery.data import DATA_FILES, df_wbm
     27 from matbench_discovery.metrics import stable_metrics

File ~/.venv/py311/lib/python3.11/site-packages/matbench_discovery/__init__.py:17
     15 pkg_name = "matbench-discovery"
     16 direct_url = Distribution.from_name(pkg_name).read_text("direct_url.json") or ""
---> 17 pkg_is_editable = json.loads(direct_url).get("dir_info", {}).get("editable", False)
     19 PKG_DIR = os.path.dirname(__file__)
     20 # repo root directory if editable install, else the pkg directory

File /opt/homebrew/Cellar/python@3.11/3.11.7/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
...
    354 except StopIteration as err:
--> 355     raise JSONDecodeError("Expecting value", s, err.value) from None
    356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
@janosh janosh added bug Something isn't working pkg PyPI package related data Data loading and processing labels Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working data Data loading and processing pkg PyPI package related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant