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

Logic around creating scrape chain_data.json seems broken #24

Open
pipermerriam opened this issue May 24, 2019 · 0 comments
Open

Logic around creating scrape chain_data.json seems broken #24

pipermerriam opened this issue May 24, 2019 · 0 comments

Comments

@pipermerriam
Copy link
Member

What is wrong.

$ ethpm scrape
EthPM CLI v0.1.0a0

Traceback (most recent call last):
  File "/home/piper/python-environments/ethpm-cli/bin/ethpm", line 11, in <module>
    load_entry_point('ethpm-cli', 'console_scripts', 'ethpm')()
  File "/home/piper/projects/ethpm-cli/ethpm_cli/main.py", line 84, in main
    scraper(args)
  File "/home/piper/projects/ethpm-cli/ethpm_cli/main.py", line 46, in scraper
    last_scraped_block = scrape(w3, ethpmcli_dir, start_block)
  File "/home/piper/projects/ethpm-cli/ethpm_cli/scraper.py", line 38, in scrape
    initialize_ethpm_dir(ethpm_dir, w3)
  File "/home/piper/projects/ethpm-cli/ethpm_cli/scraper.py", line 112, in initialize_ethpm_dir
    validate_chain_data_store(chain_data_path, w3)
  File "/home/piper/projects/ethpm-cli/ethpm_cli/validation.py", line 71, in validate_chain_data_store
    f"{chain_data_path} does not appear to be a valid EthPM CLI datastore."
ethpm_cli.exceptions.InstallError: /home/piper/.local/share/ethpmcli/chain_data.json does not appear to be a valid EthPM CLI datastore.

I previously got myself a corrupted chain_data.json file after hacking around with the system a bit. After deleting the file, this is what happens when I try to ethpm scrape

How to fix

if ethpm_dir.is_dir():

This code assumes that if the directory is present then the file must be present also. Probably worth adding a test that demonstrates this case as well as one where the document is invalid JSON so that the CLI gives good error messaging in all cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant