Opened 4 years ago

Last modified 4 months ago

#6032 defect new

make twisted.internet.endpoints importable on Windows when pywin32 is not installed

Reported by: tray Owned by:
Priority: high Milestone:
Component: core Keywords:
Cc: davidsarah Branch:
Author:

Description (last modified by exarkun)

Using Twisted 12.2, twisted.internet.endpoints cannot be imported on Windows unless pywin32 is available:

 Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "twisted\web\client.py", line 21, in <module>
    from twisted.internet.endpoints import TCP4ClientEndpoint, SSL4ClientEndpoint
  File "twisted\internet\endpoints.py", line 28, in <module>
    from twisted.internet import stdio
  File "twisted\internet\stdio.py", line 28, in <module>
    from twisted.internet import _win32stdio
  File "twisted\internet\_win32stdio.py", line 7, in <module>
    import win32api
ImportError: No module named win32api

As demonstrated by this traceback, this also affects any module that depends on endpoints. The pywin32 dependency is only necessary for stdio; other endpoints should be usable even if it is not installed.

This likely requires a Windows version of the no-modules builder to be set up first - see <https://bugs.launchpad.net/twisted-buildbot-configuration/+bug/1059240>.

Change History (8)

comment:1 Changed 4 years ago by exarkun

  • Description modified (diff)
  • Priority changed from high to normal
  • Summary changed from Either making pywin32 a requirement, or don't have endpoints break when it is missing to make twisted.internet.endpoints importable on Windows when pywin32 is not installed
  • Type changed from regression to enhancement

comment:2 Changed 4 years ago by exarkun

  • Description modified (diff)

comment:3 Changed 3 years ago by davidsarah

  • Cc davidsarah added

This would fix Tahoe-LAFS ticket https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2028 .

comment:4 Changed 3 years ago by zooko

For the upcoming Tahoe-LAFS v1.11 release, we're working-around this issue by requiring Twisted < 12.2.0:

https://github.com/tahoe-lafs/tahoe-lafs/commit/d888b28b715020e879a52f5159b6e14c7dcab6b8

comment:5 Changed 2 years ago by zooko

This interacts with https://github.com/twisted/nevow/issues/43 (why does Nevow depend on Twisted >= 13.0?).

comment:6 Changed 2 years ago by zooko

I suppose switching from pywin32 to new fork "pypiwin32" https://pypi.python.org/pypi/pypiwin32 (which exists because of this reason — http://sourceforge.net/p/pywin32/feature-requests/110/ , http://sourceforge.net/p/pywin32/bugs/669/ ) would solve this issue.

comment:7 Changed 4 months ago by glyph

  • Priority changed from normal to high
  • Type changed from enhancement to defect

OK, I guess the Tahoe problem here is recently resolved, so the original reporters are probably not motivated to fix it; but, wow, this must be a terrible onboarding experience for windows users. We should definitely fix it.

comment:8 Changed 4 months ago by glyph

Now that we test on appveyor, this (specifically, the no-modules builder) could be submitted as a regular Twisted ticket, without needing a buildbot configuration change.

Note: See TracTickets for help on using tickets.