Questions tagged [twisted.internet]

Twisted Internet: Asynchronous I/O and Events.

Twisted Internet is a collection of compatible event-loops for . It contains the code to dispatch events to interested observers and a portable API so that observers need not care about which event loop is running. Thus, it is possible to use the same code for different loops, from Twisted's basic, yet portable, select-based loop to the loops of various GUI toolkits like GTK+ or Tk.

Project and documentation: http://twistedmatrix.com/documents/current/api/twisted.internet.html

180 questions
0
votes
1 answer

How to use Asynchronous Generators in Twisted?

Twisted provides wrapping native coroutines(coroutines using async/await). Using ensureDeferred, we can wrap a coroutine and get its equivalent deferred. How to wrap an asynchronous generator (available in Python 3.6), so that we get a deferred…
hitman23
  • 11
  • 4
0
votes
2 answers

Twisted - how to make lots of Python code non-blocking

I've been trying to get this script to perform the code in hub() in written order. hub() contains a mix of standard Python code and requests to carry out I/O using Twisted and Crossbar. However, because the Python code is blocking, reactor doesn't…
sscirrus
  • 55,407
  • 41
  • 135
  • 228
0
votes
1 answer

Anaconda Jupyter Notebook error for !pip install Twisted

I am trying to do a !pip install Twisted and I am getting an error "Failed building wheel for Twisted" Any ideas? Is there any methods for installing a .wheel file directly with IPython if I download the .whl file directly from pypi.org??
bbartling
  • 3,288
  • 9
  • 43
  • 88
0
votes
0 answers

SSL handshake error twisted

So I have a twisted application where I create the SSL service like this: myfactory=MyFactory(host, port) service=SSLServer(port,myfactory, ssl.DefaultOpenSSLContextFactory(MY_SERVICE_SSL_KEY, MY_SERVICE_SSL_CERT)) Here MyFactory is just my custom…
Marc
  • 3,386
  • 8
  • 44
  • 68
0
votes
1 answer

Forking multiple process in twisted with shared object

I want to fork multiple processes with twisted. I know from the discussion here that Twisted and multiprocessing are not compatible with each other. Its true that I can launch separate processes from different terminals to achieve the same effect,…
Anurag Sharma
  • 4,839
  • 13
  • 59
  • 101
0
votes
1 answer

How to pass connection success or failure to the caller in the Twisted framework?

After working through some of the basic tutorials, I want my TCP/UDP client to exit with a code indicating whether it connected or not. The right way to return an exit code in Twisted is: point = TCP4ClientEndpoint(reactor, "localhost", 1234) d =…
ceridwen
  • 550
  • 2
  • 5
  • 14
0
votes
1 answer

Factory instance not creating a new deferred

I am pretty new to Twisted, so I am sure this is a rookie mistake. I have built a simple server which receives a message from the client and upon receipt of message the server fires a callback which prints the message to the console. At first…
Mike Bailey
  • 29
  • 1
  • 8
0
votes
1 answer

A TCP Quote Server and Client in Twisted Python fault

I'm going through a book called "Twisted Network Programming Essentials rev.2" and I have a problem with example of quote server. I've copied the code from the book but when I launch server and then client I'm having an error in client-side…
Roman
  • 733
  • 1
  • 5
  • 14
0
votes
1 answer

Twisted - UDP and TCP server together

I have a python implementation of a server 'MyServer', which connects to a network over UDP and thus, inherits from DatagramProtocol. This server can connect with the network only using UDP (this cannot be changed due to the network specification).…
Ziva
  • 3,181
  • 15
  • 48
  • 80
0
votes
1 answer

Twisted custom CancelledError

Is there a way in Twisted (Python2.7) to specify a custom exception when cancelling a deferred (possibly inheriting from CancelledError), to allow trapping only this specific type of failure?
Spektor
  • 515
  • 1
  • 4
  • 12
0
votes
1 answer

(Twisted-Autobahn) exceptions.AttributeError: 'WsProtocol' object has no attribute 'factory'

Currently I am getting the following error as the title suggests. My code for a Web Socket using Autobahn's twisted library is below. When I instantiate the WsProtocolFactory, I want to set the protocol to WsProtocol and initialize the factory with…
Brian
  • 421
  • 3
  • 20
0
votes
1 answer

Trying to use twisted on OSX

I recently found the Twisted python library and was trying to set it up with a test script. from twisted.internet.protocol import Protocol, Factory from twisted.internet import reactor class Pong(Protocol): def connectionMade(self): …
ikhaliq15
  • 143
  • 1
  • 12
0
votes
1 answer

Python Twisted Defer returnValue incompatible with dict

I am using twisted.internet.defer extensively in my package , I have encountered a problem which I am unable to solve after spending 2 days on it. Below is my problem scenario. # all imports done and correct class infrastructure: # line 1 …
chaosguru
  • 1,933
  • 4
  • 30
  • 44
0
votes
2 answers

Twisted Python factory methods aren't getting called when using reactor wrappers

I have a simple client / server setup. Here's the client code: from twisted.internet import reactor from twisted.internet import protocol from twisted.internet.endpoints import TCP4ClientEndpoint class MyProtocol(protocol.Protocol): def…
Novark
  • 419
  • 4
  • 15
0
votes
1 answer

Twisted reactor not calling functions from thread correctly

I am having problems with twisted.internet.reactor All my clients have completely identical environments, but only some experience this problem: They correctly connectTCP to the server via ws and exchange first several messages. About one minute in,…
Mirac7
  • 1,566
  • 4
  • 26
  • 44