Python RCON Help - New to development with RCON
I have a hosted service where I'm trying to connect to the RCON port and getting the error below.


valve.rcon.RCONAuthenticationError: Banned


I'm highly familiar with python, so I know the error isn't me. What I don't know is why I'm getting this error when I use the same creds as the RCON exe app my provider gave me.

What I need to know is if there is any documentation on the valve.a2s python api and the RCON api?

I'm using pip python-valve
< >
Showing 1-9 of 9 comments
Jessie 10 Jan, 2021 @ 7:39pm 
https://developer.valvesoftware.com/wiki/Source_RCON_Protocol
https://github.com/serverstf/python-valve

I have used it before, and it works for me. Check the ip, port and password are correct

simplest example (from documentation)
import valve.rcon server_address = ("...", 27015) password = "top_secret" with valve.rcon.RCON(server_address, password) as rcon: print(rcon("echo Hello, world!"))

If the password has unicode characters in it, you might need
valve.rcon.RCONMessage.ENCODING = "utf-8"

Once you have been ip banned, you will need to unban before trying again
Last edited by Jessie; 10 Jan, 2021 @ 7:43pm
knownasthatguy 10 Jan, 2021 @ 7:48pm 
I get the same error, but not when i use the exe file the provider gave me:



import valve.rcon

address = ('x.x.xx',port)
pwd = 'password'

with valve.rcon.RCON(address,pwd) as rcon:
print(rcon("echo Hello, world!"))


File "C:\Users\xxxx\PycharmProjects\rcon\venv\lib\site-packages\valve\rcon.py", line 524, in authenticate
raise RCONAuthenticationError(True)
valve.rcon.RCONAuthenticationError: Banned
knownasthatguy 10 Jan, 2021 @ 7:58pm 
actually, now i'm getting this lol......

File "C:\Users\xxxx\PycharmProjects\rcon\venv\lib\site-packages\valve\rcon.py", line 180, in decode
id_, type_ = struct.unpack("<i", fixed_fields)
struct.error: unpack requires a buffer of 4 bytes

Process finished with exit code 1
Jessie 10 Jan, 2021 @ 7:59pm 
It looks like python-valve is indicating you are banned.

If you can, check the server logs to see if the server has actually banned your ip (if it didn't ban you there may be an issue with python-valve)

The exception is being raised inside the authenticate method, around the _receive method
if timeout is None: timeout = self._timeout self._request(RCONMessage.Type.AUTH, self._password) try: response = self._receive(timeout) except RCONCommunicationError: raise RCONAuthenticationError(True)
Jessie 10 Jan, 2021 @ 8:02pm 
What type of game server is this for?
knownasthatguy 10 Jan, 2021 @ 8:31pm 
gportal, but I actually think it's working, just having an issue unpacking the data. I've never had to unpack structure data lol.

File "C:\Users\xxxx\PycharmProjects\rcon\venv\lib\site-packages\valve\rcon.py", line 171, in decode
size = struct.unpack("<ii", size_field)[0]
struct.error: unpack requires a buffer of 8 bytes
knownasthatguy 12 Jan, 2021 @ 4:55pm 
any ideas on that error?
Jessie 13 Jan, 2021 @ 7:27pm 
Originally posted by knownasthatguy:
gportal, but I actually think it's working, just having an issue unpacking the data. I've never had to unpack structure data lol.

File "C:\Users\xxxx\PycharmProjects\rcon\venv\lib\site-packages\valve\rcon.py", line 171, in decode
size = struct.unpack("<ii", size_field)[0]
struct.error: unpack requires a buffer of 8 bytes

I mean, what game / server is running ?
knownasthatguy 24 Jan, 2021 @ 2:17pm 
hell let loose / Freedom Isn't Free
< >
Showing 1-9 of 9 comments
Per page: 1530 50