Py-KMS-Organization/py-kms

Py-KMS on Python Version 3.10 not working

lodiabloc opened this issue · 11 comments

Hello

I want to use py-kms for my homelab test but cannot start the service

here step by step what i have done

py pip install tzlocal pysqlite3
  • Unzipped py-kms-master.zip at C:\KMS\
  • checking if python works correctly : OK
c:\KMS\py-kms>py
Python 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
  • try to start pykms_Server.py and get an error
c:\KMS\py-kms>py pykms_Server.py
Traceback (most recent call last):
  File "c:\KMS\py-kms\pykms_Server.py", line 27, in <module>
    from Etrigan import Etrigan, Etrigan_parser, Etrigan_check, Etrigan_job
  File "c:\KMS\py-kms\Etrigan.py", line 12, in <module>
    from collections import Sequence
ImportError: cannot import name 'Sequence' from 'collections' (C:\Program Files\Python310\lib\collections\__init__.py)

c:\KMS\py-kms>

I would like to get some help to know if i missed one step

thanks you in advance

Hi @lodiabloc

In Python 3.3 it seems Sequence was moved from collections to collections.abc which explains this behaviour you're seeing in 3.10.

You can either back date to 3.3 or alternatively you can use our Docker container to work around the issue.

I will mark this as a confirmed bug and we'll set to work fixing this.

Thanks,
Matt

Another issue as well is that it also will try to use the SO_REUSEPORT which does not exist on windows.

This is not a bug per-se as we clearly state that we are using Python 3.6.9+ in our readme and as https://endoflife.date/python reports the versions before that breaking change are far beyond their end-of-life dates.

I would prefer to close this - what do your think @Matthew-Beckett ?

This is not a bug per-se as we clearly state that we are using Python 3.6.9+ in our readme and as https://endoflife.date/python reports the versions before that breaking change are far beyond their end-of-life dates.

I would prefer to close this - what do your think @Matthew-Beckett ?

@simonmicro I'm a little confused as to your comment. You state that we use 3.6.9 however if so Sequence would have been moved from collections to collections.abc and thus this would be an actual bug as our import reference is for a version that is EoL no?

3.6.9 is going EoL in two weeks anyway, I think we should upgrade to 3.9 or 3.10, squash this bug and complete the chore of upgrading whilst we're there.

Nvm - I can confirm it.

On it.

Should work now?!

Should work now?!

Can we try and not commit to master? PRs are here for a reason...

You are right. I'll create PRs from now on... The next branch will be used from now on for direct commits :)

Thanks for the fix its now work fine @simonmicro

This is a much better fix - as it supports both:

try:
    from collections.abc import Sequence
except ImportError:
    from collections import Sequence