[Twisted-Python] Error using "python -m twisted.conch.stdio" command in command prompt
Glyph
glyph at twistedmatrix.com
Mon Jul 19 23:52:50 MDT 2021
> On Jul 18, 2021, at 11:39 PM, Melanie Molifie <mmolifie at gmail.com> wrote:
>
> Hi guys
>
> I'm new to twisted and would appreciate some beginner guidance.
>
Hi Melanie! Welcome to the community. I hope we can get you set up better.
> I'm trying to use the "python -m twisted.conch.stdio" command in command prompt but it does not work and gives the following error:
>
> C:\WINDOWS\system32>python -m twisted.conch C:\Users\Melanie\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe: No module named twisted.conch.main; 'twisted.conch' is a package and cannot be directly executed
>
In this example you're doing `python -m twisted.conch`, not `python -m twisted.conch.stdio`, which will not work anywhere.
Unfortunately, the Conch standard-IO library (and therefore the conch terminal client, and twisted.conch.stdio) doesn't work on Windows and never has: https://twistedmatrix.com/trac/ticket/2157 <https://twistedmatrix.com/trac/ticket/2157>. However, you may be able to get it up and running with the Windows Subsystem for Linux, which I believe will present a Linux-like interface since as far as the application knows it's running on Linux: https://docs.microsoft.com/en-us/windows/wsl/about <https://docs.microsoft.com/en-us/windows/wsl/about>
> I'm hoping that this will solve the rest of the error messages I'm having. I want to eventually be ably to run :
>
> >>> from twisted.names import client
> >>> client.getHostByName('www.example.com <http://www.example.com/>')
> <Deferred at 0xf5c5a8 waiting on Deferred at 0xf5cb90>
> >>> _
> <Deferred at 0xf5c5a8 current result: '2606:2800:220:6d:26bf:1447:1097:aa7'>
>
> >>> client.lookupMailExchange('twistedmatrix.com <http://twistedmatrix.com/>')
> <Deferred at 0xf5cd40 waiting on Deferred at 0xf5cea8>
> >>> _
> <Deferred at 0xf5cd40 current result: ([<RR name=twistedmatrix.com <http://twistedmatrix.com/> type=MX class=IN ttl=1s auth=False>], [], [])>
Is the goal here specifically to do this with Conch, or would doing it with Jupyter Notebook (using something like https://twitter.com/glyph/status/1417360623818575876 <https://twitter.com/glyph/status/1417360623818575876> which I found while researching a response to this email!) be sufficient?
Or, for that matter, could you just write a little program? A sample Python script that runs the reactor is probably easier to set up than a reactor-enabled REPL, particularly on Windows. (There are various options for a reactor-enabled REPL, it's definitely doable, but it might be a bit rough as a first step; as you're discovering.)
> The aim is to get the deferred responses as shown in previous code, but all I get is:
>
> >>> from twisted.names import client
> >>> client.getHostByName('www.example.com <http://www.example.com/>')
> <Deferred at 0x263d27b9dc8 waiting on Deferred at 0x263d27b9f48>
> >>> _
> <Deferred at 0x263d27b9dc8 waiting on Deferred at 0x263d27b9f48>
> >>> client.lookupMailExchange('twistedmatrix.com <http://twistedmatrix.com/>')
> <Deferred at 0x263d27c6a88 waiting on Deferred at 0x263d27c6c08>
> >>> _
> <Deferred at 0x263d27c6a88 waiting on Deferred at 0x263d27c6c08>
The reason you're getting this with a normal Python interactive interpreter is that the event loop which actually performs the I/O (does the DNS queries, in this case) isn't running at all, so the Deferreds are created, but never resolved.
> Please help. I'm trying to send this to the twisted mailing group. If I'm wrong please nudge me in the right direction.
>
This is as good a place as any :).
> Thanks in advance.
>
> M
>
> On Mon, Jul 19, 2021 at 12:43 AM Richard van der Hoff <richard at matrix.org <mailto:richard at matrix.org>> wrote:
> On 16/07/2021 20:27, Glyph wrote:
> >
> >> One particular problem I came across was the type annotation on
> >> inlineCallbacks. I've filed
> >> https://twistedmatrix.com/trac/ticket/10231 <https://twistedmatrix.com/trac/ticket/10231> about it - would
> >> appreciate thoughts.
> >>
> > This definitely looks wrong; there should be a TypeVar in there. Adi,
> > I'd go so far as to say that this should be a release blocker,
> > although the change should be fairly minimal.
> >
> > Richard, could you please make a proper PR for this to get CI kicked
> > off and make sure the new annotation doesn't cause any failures?
> Done, in the form of https://github.com/twisted/twisted/pull/1632 <https://github.com/twisted/twisted/pull/1632>.
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com <mailto:Twisted-Python at twistedmatrix.com>
> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python <https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20210719/7215063d/attachment-0001.htm>
More information about the Twisted-Python
mailing list