Coder Social home page Coder Social logo

Comments (7)

aeyrnsun avatar aeyrnsun commented on May 18, 2024 1

I have tried this also on a Windows 10 PRO running Python 3.8.2 with this...

Exception in thread Thread-Srv:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File ".\pykms_Server.py", line 150, in run
self.server.pykms_serve()
File ".\pykms_Server.py", line 81, in pykms_serve
ready = selector.select(timeout)
File "C:\Program Files (x86)\Python38-32\lib\selectors.py", line 323, in select
r, w, _ = self._select(self._readers, self._writers, [], timeout)
File "C:\Program Files (x86)\Python38-32\lib\selectors.py", line 314, in _select
r, w, x = select.select(r, w, w, timeout)
OSError: [WinError 10038] An operation was attempted on something that is not a socket

from py-kms.

simonmicro avatar simonmicro commented on May 18, 2024

I have tried this also on a Windows 10 PRO running Python 3.8.2 with this...

Exception in thread Thread-Srv:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File ".\pykms_Server.py", line 150, in run
self.server.pykms_serve()
File ".\pykms_Server.py", line 81, in pykms_serve
ready = selector.select(timeout)
File "C:\Program Files (x86)\Python38-32\lib\selectors.py", line 323, in select
r, w, _ = self._select(self._readers, self._writers, [], timeout)
File "C:\Program Files (x86)\Python38-32\lib\selectors.py", line 314, in _select
r, w, x = select.select(r, w, w, timeout)
OSError: [WinError 10038] An operation was attempted on something that is not a socket

This is only a guess, but what other Software is running while you attempt this? My guess is, that python looses the socket context, maybe caused by a firewall or an anti-virus software. Please try disable all of them. If that still fails, I'll lool further into that.

from py-kms.

05u avatar 05u commented on May 18, 2024

我也在具有此功能的运行Python 3.8.2的Windows 10 PRO上尝试过此操作...
线程Thread-Srv中的异常:
追溯(最近一次调用):
文件“ C:\ Program Files(x86)\ Python38-32 \ lib \ threading.py”,第932行,位于_bootstrap_inner
self.run()
文件中。 \ pykms_Server.py”,第150行,运行
self.server.pykms_serve()
文件“。\ pykms_Server.py”,第81行,pykms_serve
ready = selector.select(timeout)
文件“ C:\ Program Files(x86)” \ Python38-32 \ lib \ selectors.py“,第323行,在选择
r,w,_ = self._select(self._readers,self._writers,[],超时)中,
文件“ C:\ Program Files(x86) \ Python38-32 \ lib \ selectors.py“,第314行,在_select
r,w,x = select.select(r,w,w,timeout)
OSError中:[WinError 10038]尝试对非套接字的对象进行操作

这只是一个猜测,但是尝试执行此操作时还会运行什么其他软件?我的猜测是,python会松开套接字上下文,这可能是由防火墙或防病毒软件引起的。请尝试禁用所有这些。如果仍然失败,我将进一步讲解。

I have tried this also on a Windows 10 PRO running Python 3.8.2 with this...
Exception in thread Thread-Srv:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File ".\pykms_Server.py", line 150, in run
self.server.pykms_serve()
File ".\pykms_Server.py", line 81, in pykms_serve
ready = selector.select(timeout)
File "C:\Program Files (x86)\Python38-32\lib\selectors.py", line 323, in select
r, w, _ = self._select(self._readers, self._writers, [], timeout)
File "C:\Program Files (x86)\Python38-32\lib\selectors.py", line 314, in _select
r, w, x = select.select(r, w, w, timeout)
OSError: [WinError 10038] An operation was attempted on something that is not a socket

This is only a guess, but what other Software is running while you attempt this? My guess is, that python looses the socket context, maybe caused by a firewall or an anti-virus software. Please try disable all of them. If that still fails, I'll lool further into that.

Hello, I have the same mistake. I tried to solve it but failed.

The computer system I run on the server is windows 10. There is no security software and the firewall is closed.

from py-kms.

aeyrnsun avatar aeyrnsun commented on May 18, 2024

I have also tries this on HYPER-V vm's running on Server 2019 Standard, Server 2012 R2 Standard and Server 2016 Standard. All VM's very running with no anti virus or security software - out of the box so to speak! All failed to run

from py-kms.

ldti avatar ldti commented on May 18, 2024

Same here. Used to work find on one of the older releases of py-kms.
this is happening on a container , based on server 1809.

from py-kms.

SystemRage avatar SystemRage commented on May 18, 2024

By now i can't debug anymore versus Windows errors because my Win test Pc is died.
But i think the problem is that i used os.pipe() with Selectors / select() and stupid Windows only works for sockets. (https://docs.python.org/3/library/select.html)
A quick and dirty fix is to comment (in pykms_Server.py) all references to self.r_service, self.w_service like this:

class KeyServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
        daemon_threads = True
        allow_reuse_address = True

        def __init__(self, server_address, RequestHandlerClass):
                socketserver.TCPServer.__init__(self, server_address, RequestHandlerClass)
                self.__shutdown_request = False
                #self.r_service, self.w_service = os.pipe() #Comment here

                if hasattr(selectors, 'PollSelector'):
                        self._ServerSelector = selectors.PollSelector
                else:
                        self._ServerSelector = selectors.SelectSelector

        def pykms_serve(self):
                """ Mixing of socketserver serve_forever() and handle_request() functions,
                    without elements blocking tkinter.
                    Handle one request at a time, possibly blocking.
                    Respects self.timeout.
                """
                # Support people who used socket.settimeout() to escape
                # pykms_serve() before self.timeout was available.
                timeout = self.socket.gettimeout()
                if timeout is None:
                        timeout = self.timeout
                elif self.timeout is not None:
                        timeout = min(timeout, self.timeout)
                if timeout is not None:
                        deadline = time() + timeout

                try:
                        # Wait until a request arrives or the timeout expires.
                        with self._ServerSelector() as selector:
                                selector.register(fileobj = self, events = selectors.EVENT_READ)
                                # self-pipe trick.
                                #selector.register(fileobj = self.r_service, events = selectors.EVENT_READ) #Comment here

                                while not self.__shutdown_request:
                                        ready = selector.select(timeout)
                                        if self.__shutdown_request:
                                                break

                                        if ready == []:
                                                if timeout is not None:
                                                        timeout = deadline - time()
                                                        if timeout < 0:
                                                                return self.handle_timeout()
                                        else:
                                                for key, mask in ready:
                                                        if key.fileobj is self:
                                                                self._handle_request_noblock()
                                                        #elif key.fileobj is self.r_service:  ##Comment this block.
                                                                # only to clean buffer.
                                                                #msgkill = os.read(self.r_service, 8).decode('utf-8')
                                                                #sys.exit(0)
                finally:
                        self.__shutdown_request = False

in this way however py-kms Gui Exit button functionality is lost.
A more appropriate fix (with a next update) is to create a socketpair() function working with python2 and Windows.

from py-kms.

16486994 avatar 16486994 commented on May 18, 2024

As far as I know, can this thing be started on Linux and then activated on windows。What is the result of using it?

from py-kms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.