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

List index out of range #90

Closed
emielmaters opened this issue Feb 8, 2022 · 12 comments
Closed

List index out of range #90

emielmaters opened this issue Feb 8, 2022 · 12 comments
Labels
Enhancement New feature or request

Comments

@emielmaters
Copy link

Hello,
It appears that the uploading does not work properly. Some time ago, the test worked.
Now I want to upload the NFT's, but I get the following error:

Traceback (most recent call last): File "D:\Users\Emiel Maters\Downloads\opensea-automatic-bulk-upload-and-sale-master(1)\opensea-automatic-bulk-upload-and-sale-master\main.py", line 716, in <module> structure.get_data(nft_number) # Structure the data of the NFT. File "D:\Users\Emiel Maters\Downloads\opensea-automatic-bulk-upload-and-sale-master(1)\opensea-automatic-bulk-upload-and-sale-master\main.py", line 103, in get_data eval('self.structure_' + self.extension + '()') File "<string>", line 1, in <module> File "D:\Users\Emiel Maters\Downloads\opensea-automatic-bulk-upload-and-sale-master(1)\opensea-automatic-bulk-upload-and-sale-master\main.py", line 122, in structure_xlsx self.structure_data([ File "D:\Users\Emiel Maters\Downloads\opensea-automatic-bulk-upload-and-sale-master(1)\opensea-automatic-bulk-upload-and-sale-master\main.py", line 170, in structure_data self.unlockable_content: list or bool = nft_data[8] # [bool, str]. IndexError: list index out of range PS D:\Users\Emiel Maters\Downloads\opensea-automatic-bulk-upload-and-sale-master(1)\opensea-automatic-bulk-upload-and-sale-master>

I can't find what occurs the error. The excel file seems fine, I used [False] as argument.

Kind regards,
Emiel

@NovusEdge
Copy link

I would like to suggest that you try and format the error message better. i.e. use:

```
...
error message
...
```

PS: I'd love to help, If this issue is still open I would like to take it up
Cheers! 🎊

@emielmaters
Copy link
Author

Thanks for your response.

So, this is the whole error message, I think:

...
Traceback (most recent call last): File "D:\Users\Emiel Maters\Downloads\opensea-automatic-bulk-upload-and-sale-master(1)\opensea-automatic-bulk-upload-and-sale-master\main.py", line 716, in <module> structure.get_data(nft_number) # Structure the data of the NFT. File "D:\Users\Emiel Maters\Downloads\opensea-automatic-bulk-upload-and-sale-master(1)\opensea-automatic-bulk-upload-and-sale-master\main.py", line 103, in get_data eval('self.structure_' + self.extension + '()') File "<string>", line 1, in <module> File "D:\Users\Emiel Maters\Downloads\opensea-automatic-bulk-upload-and-sale-master(1)\opensea-automatic-bulk-upload-and-sale-master\main.py", line 122, in structure_xlsx self.structure_data([ File "D:\Users\Emiel Maters\Downloads\opensea-automatic-bulk-upload-and-sale-master(1)\opensea-automatic-bulk-upload-and-sale-master\main.py", line 170, in structure_data self.unlockable_content: list or bool = nft_data[8] # [bool, str]. IndexError: list index out of range PS D:\Users\Emiel Maters\Downloads\opensea-automatic-bulk-upload-and-sale-master(1)\opensea-automatic-bulk-upload-and-sale-master>
...

I think it gives an error on the data from the Excel file, but I checked it twice. The input is a boolean: [False].

@NovusEdge
Copy link

NovusEdge commented Feb 9, 2022

I believe the error shows the problem is with line 170 in main.py:

self.unlockable_content: list or bool = nft_data[8] # [bool, str].

Could you please tell me what nft_data is about, is there a defined structure for the array?

The code's a bit messy, to be honest.

Also, there is no checking for the length of nft_data or about it's structure, so it's inevitable that the index error will come if the array is, say, empty.

Also, the get_data function is bad practice, better to use checking of strings and extensions rather than evaling. eval is unsafe.

It's best to implement checking of the data extracted from the structure_<extension> methods

@maximedrn
Copy link
Owner

Send me an excerpt of your file

I believe the error shows the problem is with line 170 in main.py:

self.unlockable_content: list or bool = nft_data[8] # [bool, str].

Could you please tell me what nft_data is about, is there a defined structure for the array?

The code's a bit messy, to be honest.

Also, there is no checking for the length of nft_data or about it's structure, so it's inevitable that the index error will come if the array is, say, empty.

Also, the get_data function is bad practice, better to use checking of strings and extensions rather than evaling. eval is unsafe.

It's best to implement checking of the data extracted from the structure_<extension> methods

eval method is not bad when using correctly

@emielmaters
Copy link
Author

Do you want me to send the complete .xlsx file?
Or is this enough:
afbeelding

Kind regards,
Emiel

@NovusEdge
Copy link

Do you want me to send the complete .xlsx file?

If you can, please do send the format for the .xlsx file. Don't send the entire file though.

@emielmaters
Copy link
Author

Oke, see the file below:
Map1.xlsx
Is this working for you?

@maximedrn
Copy link
Owner

maximedrn commented Feb 10, 2022

You file path is incorrect, change the "" with "\" or "/".
Duration cannot be "6 months", you have to use the DD-MM-YYYY hh:mm format.

@maximedrn
Copy link
Owner

I believe the error shows the problem is with line 170 in main.py:

self.unlockable_content: list or bool = nft_data[8] # [bool, str].

Could you please tell me what nft_data is about, is there a defined structure for the array?

The code's a bit messy, to be honest.

Also, there is no checking for the length of nft_data or about it's structure, so it's inevitable that the index error will come if the array is, say, empty.

Also, the get_data function is bad practice, better to use checking of strings and extensions rather than evaling. eval is unsafe.

It's best to implement checking of the data extracted from the structure_<extension> methods

I will add in a next update some changes concerning the Structure class, many people get errors because they do not follow the README file :/

@NovusEdge
Copy link

NovusEdge commented Feb 10, 2022

I will add in a next update some changes concerning the Structure class, many people get errors because they do not follow the README file :/

True, but it's best to assume the worst from the end-user, isn't it?. Clean and organized code is good code 😄
I do want to know exactly how the nft_data is obtained. Is it through some sort of API or is it parsed in some way?

Knowing this may save us the effort of implementing a useless class if the data is always in the same format. If this is the case, it's best to just implement the checking.

@maximedrn maximedrn added the Enhancement New feature or request label Feb 13, 2022
@emielmaters
Copy link
Author

When I want to start the script, it now gives another error:

...
 line 32, in <module>
    from webdriver_manager.chrome import ChromeDriverManager as CDM
ModuleNotFoundError: No module named 'webdriver_manager'
...

I have the most up-to-date chrome driver.

Visual code gives this message: Import "webdriver_manager.chrome" could not be resolved.

Does someone know what is going wrong?

@maximedrn
Copy link
Owner

maximedrn commented Feb 14, 2022

pip install -r requirements.txt
I added a new module that automatically download the webdriver.

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

No branches or pull requests

3 participants