DarkCat09 / python-aternos

[UNMAINTAINED] Unofficial Aternos API written in Python
https://pypi.org/project/python-aternos/
Apache License 2.0
92 stars 13 forks source link

Error in __init__.py #13

Closed SlamTheDragon closed 2 years ago

SlamTheDragon commented 2 years ago

The Problem

Using a java maven build for a bot designed specifically for a private server, I attempted to integrate this python aternos api using jython and somehow got an error within the library

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ":\directory\to\project\repository\COMPILED.jar\Lib\python_aternos\__init__.py", line 15
    def __init__(self, atconn:atconnect.AternosConnect) -> None:
                            ^
SyntaxError: mismatched input ':' expecting RPAREN

I couldn't find any more way to execute a py script inside a compiled jar file so I was left with this very last option and was greeted by this result

Any feedback are much appreciated, thanks!


Snippet of Java code:

try (PythonInterpreter pyInit = new PythonInterpreter()) {
   pyInit.exec("from python_aternos import Client");
   pyInit.exec("aternos = Client.from_credentials('*****','*****')");
   pyInit.exec("servs = aternos.list_servers()");
   pyInit.exec("myserv = servs[0]");
   pyInit.exec("myserv.start()");
   pyInit.exec("print('Server has been pinged to start')");
}
DarkCat09 commented 2 years ago

I've never used Jython, but, considering the error message, I think it doesn't support the mypy syntax.
The module is created for the original Python interpreter and I can't guarantee the proper work of python-aternos in other Python implementations.

SlamTheDragon commented 2 years ago

Well that sounds unfortunate.. I'll try to get around with this then if there is another way of doing it, though thanks for the help!

SlamTheDragon commented 2 years ago

Update:

The embedded aternos python library works with JEP