Coder Social home page Coder Social logo

client.players error about mcipc HOT 15 CLOSED

conqp avatar conqp commented on July 17, 2024
client.players error

from mcipc.

Comments (15)

conqp avatar conqp commented on July 17, 2024

Please provide the full exception traceback.

from mcipc.

SwiftCoding256 avatar SwiftCoding256 commented on July 17, 2024

Sure!

Traceback (most recent call last):
  File "C:/Users/Kunde/PycharmProjects/dscbot/test.py", line 10, in <module>
    players = client.players
  File "C:\Users\Kunde\PycharmProjects\dscbot\venv\lib\site-packages\mcipc\rcon\client.py", line 102, in players
    return Players.from_response(response)
  File "C:\Users\Kunde\PycharmProjects\dscbot\venv\lib\site-packages\mcipc\rcon\datastructures\players.py", line 25, in from_response
    online, max_, names = match.groups()
AttributeError: 'NoneType' object has no attribute 'groups'

from mcipc.

conqp avatar conqp commented on July 17, 2024

It looks like the players command returns an unexpected string.
To investigate this, you can insert a print statement after line 23 in players.py:

print('DEBUG:', text)

In any case: Which version of Minecraft server are you using?

from mcipc.

SwiftCoding256 avatar SwiftCoding256 commented on July 17, 2024

Got this with the Debug for now:

DEBUG: §6Es sind §c0§6 von maximal §c20§6 Spielern online.

Traceback (most recent call last):
  File "C:/Users/Kunde/PycharmProjects/dscbot/test.py", line 10, in <module>
    players = client.players
  File "C:\Users\Kunde\PycharmProjects\dscbot\venv\lib\site-packages\mcipc\rcon\client.py", line 102, in players
    return Players.from_response(response)
  File "C:\Users\Kunde\PycharmProjects\dscbot\venv\lib\site-packages\mcipc\rcon\datastructures\players.py", line 26, in from_response
    online, max_, names = match.groups()
AttributeError: 'NoneType' object has no attribute 'groups'

Process finished with exit code 0

The Server runs on Version 1.15.2 Paper

from mcipc.

conqp avatar conqp commented on July 17, 2024

Well, the §c0§6 and §c20§6 should be the respective numbers only.
I.e. 0 and 20 respectively. I don't know where these special character come from.
What does Paper mean with regards to the version? Is this not a vanilla Minecraft server?

from mcipc.

SwiftCoding256 avatar SwiftCoding256 commented on July 17, 2024

Right, its a replacement for Spigot.

from mcipc.

SwiftCoding256 avatar SwiftCoding256 commented on July 17, 2024

But, the others requests are working.

from mcipc.

conqp avatar conqp commented on July 17, 2024

Well. This plugin obviously results in a different server response.
Unfortunately I don't have enough information on how the responses might look.
If you'd like this function to be supported on this server version, please provide the above debug output with at least two players online, so that I can infer the output format.

from mcipc.

SwiftCoding256 avatar SwiftCoding256 commented on July 17, 2024

Do you mean like this?

Traceback (most recent call last):
DEBUG: §6Es sind §c2§6 von maximal §c20§6 Spielern online.
  File "C:/Users/Kunde/PycharmProjects/dscbot/test.py", line 10, in <module>
    players = client.players
  File "C:\Users\Kunde\PycharmProjects\dscbot\venv\lib\site-packages\mcipc\rcon\client.py", line 102, in players
§6dev§r: §4SwiftCoding§r§f
    return Players.from_response(response)
§6obsidian§r: JustLetHerGo§f
  File "C:\Users\Kunde\PycharmProjects\dscbot\venv\lib\site-packages\mcipc\rcon\datastructures\players.py", line 26, in from_response

    online, max_, names = match.groups()
AttributeError: 'NoneType' object has no attribute 'groups'

Process finished with exit code 1

from mcipc.

conqp avatar conqp commented on July 17, 2024

If that's the actual output with two players online, then yes.
But this would mean, that your server version does not return the player names.
This again would mean, that the respective data structure will not have the player names available.

from mcipc.

SwiftCoding256 avatar SwiftCoding256 commented on July 17, 2024

it kinda returns the playernames i guess?

from mcipc.

SwiftCoding256 avatar SwiftCoding256 commented on July 17, 2024
§6dev§r: §4SwiftCoding§r§f
    return Players.from_response(response)
§6obsidian§r: JustLetHerGo§f

Here - in the error - we got the names. I just dont get the error.

from mcipc.

SwiftCoding256 avatar SwiftCoding256 commented on July 17, 2024

So..i sorrounded it with a TryException and now it works more or less.

try:
    with Client('ip + port) as client:
        client.login('pass')
        players = client.players
        mansion = client.locate('Mansion')
        print(players)
        print(mansion)
except:
    print()

Output:

DEBUG: §6Es sind §c1§6 von maximal §c20§6 Spielern online.
§6login§r: JustLetHerGo§f

from mcipc.

conqp avatar conqp commented on July 17, 2024

Please test, whether version 1.4.34 fixes this issue.

from mcipc.

SwiftCoding256 avatar SwiftCoding256 commented on July 17, 2024

For some reason my Python IDE didnt let me update it via pip...
But after some work i updated it.
It works. Thank you!

from mcipc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.