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

len(advancedCollectible) -1 out of range #93

Open
snowyaya opened this issue Mar 27, 2022 · 6 comments
Open

len(advancedCollectible) -1 out of range #93

snowyaya opened this issue Mar 27, 2022 · 6 comments

Comments

@snowyaya
Copy link
Contributor

Hi,
I was trying to run the create_metadata.py, but got the error saying the len(Advanced_Collectible)-1 is out of range. More details of the error is shown as below.

I tried to pin the file to Pinata, which was successful, but not sure why Advanced_Collectible doesn't contain anything.
Any idea of the reason?

Brownie v1.17.2 - Python development framework for Ethereum

NftMixProject is the active project.

Launching 'ganache-cli --accounts 10 --hardfork istanbul --gasLimit 12000000 --mnemonic brownie --port 8545'...

Running 'scripts/advanced_collectible/create_metadata.py::main'...
Working on development
  File "brownie/_cli/run.py", line 50, in main
    return_value, frame = run(
  File "brownie/project/scripts.py", line 103, in run
    return_value = f_locals[method_name](*args, **kwargs)
  File "./scripts/advanced_collectible/create_metadata.py", line 25, in main
    advanced_collectible = AdvancedCollectible[len(AdvancedCollectible) - 1]
  File "brownie/network/contract.py", line 173, in __getitem__
    return self._contracts[i]
IndexError: list index out of range
Terminating local RPC client...
@snowyaya
Copy link
Contributor Author

I actually found this line from create_metadata.py
advanced_collectible = AdvancedCollectible[len(Advanced_Collectible)-1]
is actually written as
advanced_collectible = AdvancedCollectible[-1] in the lecture.

Are there any difference? I tried both, but still have the same issue.

@snowyaya
Copy link
Contributor Author

snowyaya commented Mar 27, 2022

I actually figured it out. It works now by just following what you did in the lecture.

  1. change from advanced_collectible = AdvancedCollectible[len(Advanced_Collectible)-1] to advanced_collectible = AdvancedCollectible[-1]
  2. change the breed_to_image_uri to
breed_to_image_uri = {
    "PUG": "https://ipfs.io/ipfs/QmSsYRx3LpDAb1GZQm7zZ1AuHZjfbPkD6J7s9r41xu1mf8?filename=pug.png",
    "SHIBA_INU": "https://ipfs.io/ipfs/QmYx6GsYAKnNzZ9A6NvEKV9nf1VaDzJrqDR23Y8YSkebLU?filename=shiba-inu.png",
    "ST_BERNARD": "https://ipfs.io/ipfs/QmUPjADFGEKmfohdTaNcWhp7VGk26h5jXDA7v3VtTnTLcW?filename=st-bernard.png",
}

So how can I help to revise the code in the repo?

@PatrickAlphaC
Copy link
Owner

Awesome! Thanks for making these issues!

I think maybe it would be wise to maybe add some print statements throughout the repo to help people who get stuck...

Or are you saying the code you're using is different than the code in this repo?

@snowyaya
Copy link
Contributor Author

@PatrickAlphaC The code I am using is different from this repo..

@PatrickAlphaC
Copy link
Owner

Ah... ok! Could you make a PR showing what you changed to help fix this one?

Interesting that working with https://ipfs.io/ipfs is working over ipfs://.... Might be something with your local ipfs node or something...

@snowyaya
Copy link
Contributor Author

Hi @PatrickAlphaC! I just created the pr for this issue and the issue in #93. I think you did https://ipfs.io/ipfs in the lecture.

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

2 participants