Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query error #7

Open
cheditx opened this issue Jun 12, 2022 · 3 comments
Open

query error #7

cheditx opened this issue Jun 12, 2022 · 3 comments

Comments

@cheditx
Copy link

cheditx commented Jun 12, 2022

with mcquery("pe.mchub.com", 19132) as data:
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 135, in enter
return next(self.gen)
File "C:\Users\User\McpeServerInfoSito\venv\lib\site-packages\mcquery\query.py", line 101, in mcquery
request_stat = MC_QUERY_MAGIC + MC_QUERY_STATISTICS + struct.pack('>l', randint(1, 9999999)) + struct.pack('>l', int(token)) + payload
ValueError: invalid literal for int() with base 10: '1380818460\x00'

@w-gao
Copy link
Owner

w-gao commented Jun 12, 2022

Hi @cheditx, thank you for your report!

I can confirm that this is happening on my machine as well, and I think what happened is that the server software pe.mchub.com is using does not guarantee the token to be an integer. To fix this, we could just not decode it here and pack the token exactly how we received it:

token = soc.recv(65535)[5:-1].decode()

I will make a fix later this week.

In any case, it is getting harder for me to recommend this tool over my other package py-mcstats: https://github.com/w-gao/py-mcpe-stats, because most servers (that I know of) are either moving away from PocketMine or disabling the query protocol. I may have to archive this project soon.

@cheditx
Copy link
Author

cheditx commented Jun 13, 2022

Hi @cheditx, thank you for your report!

I can confirm that this is happening on my machine as well, and I think what happened is that the server software pe.mchub.com is using does not guarantee the token to be an integer. To fix this, we could just not decode it here and pack the token exactly how we received it:

token = soc.recv(65535)[5:-1].decode()

I will make a fix later this week.

In any case, it is getting harder for me to recommend this tool over my other package py-mcstats: https://github.com/w-gao/py-mcpe-stats, because most servers (that I know of) are either moving away from PocketMine or disabling the query protocol. I may have to archive this project soon.

bruhhhh don't archive this project, is really cool, and my friend fixed the file query.py, in these days he post the fork :)

@w-gao
Copy link
Owner

w-gao commented Jun 14, 2022

bruhhhh don't archive this project, is really cool, and my friend fixed the file query.py, in these days he post the fork :)

Thanks for the support! I'll at least update the README to prefer the py-mcstats package instead. I could also merge the two together at some point, which I have been wanting to do for a while.

Free feel to create a PR so I can merge the fix in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants