+7

Include Python's select module on Windows

Geoff Greer 11 ár síðan 0

On Windows, the version of Python bundled with Sublime Text 2 lacks the select module. This makes it very difficult to keep persistent TCP connections open without blocking a thread.


I'm writing a plugin that uses a select() loop. I knew Python's select() could only be used on sockets on Windows. That was fine for my needs. Unfortunately, I didn't know the entire module was removed in Sublime Text 2's Python. I discovered this when a user reported a bug and gave me a traceback:


Reloading plugin C:\Users\<USERNAME>\AppData\Roaming\Sublime Text 2\Packages\Floobits\floobits.py
    Traceback (most recent call last):
      File ".\sublime_plugin.py", line 62, in reload_plugin
      File ".\floobits.py", line 15, in <module>
        from floo import api
      File ".\floo\__init__.py", line 2, in <module>
        from agent_connection import AgentConnection
      File ".\floo\agent_connection.py", line 6, in <module>
        import select
    ImportError: No module named select


Please fix this. It's hard enough to write plugins that work on OS X, Linux, and Windows without having to worry about missing modules.


I also ran into the ssl module missing on Linux, but that bug has already been reported.