conqp / rcon

Python RCON client library
GNU General Public License v3.0
83 stars 15 forks source link

demo code brings error #5

Closed N0rimaki closed 2 years ago

N0rimaki commented 2 years ago

Hey,

did you every tried this Code? Python 3.9.0 (win10 21h2 19044.1415)

from rcon import rcon

response = await rcon('some_command', 'with', 'some', 'arguments',
                      host='127.0.0.1', port=5000, passwd='mysecretpassword')
print(response)

it ends with

D:\git\rcon_play>main.py
  File "D:\git\rcon_play\main.py", line 3
    response = await rcon('some_command', 'with', 'some', 'arguments',
               ^
SyntaxError: 'await' outside function
conqp commented 2 years ago

Well, yes. The example snippets are for Python developers with common sense. Of course they are not standalone programs that can be successfully run without context. Also I doubt, that there are local RCON servers accepting the command some_command with the parameters with some arguments and using "mysecretpassword" as a password. The usage examples are there to give you an idea of how they are intended to be used. They are not copy-paste snippets for people who don't know what they are doing.