Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

IndexError: list index out of range #42

Closed
BlueSchnabeltier opened this issue Jul 29, 2022 · 7 comments · Fixed by #43
Closed

IndexError: list index out of range #42

BlueSchnabeltier opened this issue Jul 29, 2022 · 7 comments · Fixed by #43
Labels
bug Something isn't working

Comments

@BlueSchnabeltier
Copy link

BlueSchnabeltier commented Jul 29, 2022

My Code:

from python_aternos import Client

aternos = Client.from_credentials('USERNAME', 'PASSWORD')
servs = aternos.list_servers()
myserv = servs[0]

myserv.start()

Error:

Traceback (most recent call last):
  File "C:\Users\User\Desktop\test.py", line 5, in <module>
    myserv = servs[0]
IndexError: list index out of range
@DarkCat09
Copy link
Owner

Add this code to the beginning of your python script before "from python_aternos ...":

import logging
logging.basicConfig(level=logging.DEBUG)

Then run it and send me all output, please.

@DarkCat09
Copy link
Owner

servs[0]
IndexError: list index out of range

Are you sure you have any servers?
Also, try updating to the new version using command

pip install -U python-aternos

@Mastermind0100
Copy link

I am facing this issue too. The list of servers returns no servers (empty list), though I do have a server

@BlueSchnabeltier
Copy link
Author

Im now just using 1.0.2.

@DarkCat09
Copy link
Owner

The latest version is 1.1.1.

# Update module and run your code again
pip install -U "python-aternos>=1.1.1"

@Mastermind0100
Copy link

The latest version is 1.1.1.

I am on 1.1.1, still facing the same issue

@Mastermind0100
Copy link

Mastermind0100 commented Jul 31, 2022

@DarkCat09
I might be wrong here, but the xpaths in the atclient.py file on line 196 and 197 are not working on the aternos website. They may have changed on the website perhaps?
Removing line 196 and adding a slash on line 197 made it work for me

'//div[@class="server-body"]/@data-id'

@DarkCat09 DarkCat09 linked a pull request Aug 1, 2022 that will close this issue
@DarkCat09 DarkCat09 added the bug Something isn't working label Aug 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants