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
14
votes
2 answers

Calling Scrapy from another file without threading

I have to call the crawler from another python file, for which I use the following code. def crawl_koovs(): spider = SomeSpider() settings = get_project_settings() crawler = Crawler(settings) crawler.signals.connect(reactor.stop,…
Pravesh Jain
  • 4,128
  • 6
  • 28
  • 47
9
votes
3 answers

Twisted unhandled error

When the twisted reactor is running and an exception occurs within a deferred that isn't caught, "Unhandled Error" is printed to the terminal along with a traceback and the exception. Is it possible to handle/intercept these exceptions (e.g., set a…
Uyghur Lives Matter
  • 18,820
  • 42
  • 108
  • 144
8
votes
2 answers

Python scrapy ReactorNotRestartable substitute

I have been trying to make an app in Python using Scrapy that has the following functionality: A rest api (I had made that using flask) listens to all requests to crawl/scrap and return the response after crawling.(the crawling part is short…
sagar
  • 725
  • 2
  • 13
  • 30
7
votes
2 answers

No such file or directory / KeyError / bad file descriptor from Twisted's epollreactor.py

After running for some time, our Twisted server application accepts connections but will not read any data and eventually hangs. We saw the following errors in our logs: Unhandled Error Traceback (most recent call last): File…
allen
  • 79
  • 2
5
votes
1 answer

Autobahn Asyncio ReconnectingClientFactory

I would like to make a ReconnectingClientFactory with asyncio. In particular to handle the case that the server is not available when the client is started in which case the ReconnectingClientFactory will keep trying. That is something that the…
Dan Schien
  • 1,392
  • 1
  • 17
  • 29
5
votes
1 answer

ImportError: No module named 'twisted'

I'm new to python and I'm writing a simple TCP server Server.py, and I'm trying to import the reactor using this line of code from twisted.internet import reactor The problem is when I run the code I get this…
Nada
  • 97
  • 1
  • 7
5
votes
1 answer

How do Twisted python Factory and Protocol interfaces work?

I am learning Twisted, and beginner's tutorial often uses Factory and Protocol as examples. It appears that Factory and Protocol interfaces do not support sending messages. Is it expected that sending messages are implemented independently of…
Pippi
  • 2,451
  • 8
  • 39
  • 59
5
votes
1 answer

Scrapy from Script. Will not export data

I am trying to run scrapy from a script and I cannot get the program to create the export file I have tried to get the file to export in two different ways: With a pipeline With Feed export. Both of these ways work when I run scrapy from the…
12Ryan12
  • 304
  • 2
  • 9
5
votes
2 answers

deferToThread vs Deferred()

I would like to understand what happens with the below 2 code snippets - SNIPPET#1 from twisted.internet import threads, defer, reactor def proc1(a): while True: print "Proc----------1" def proc2(a): while True: print…
deeshank
  • 4,286
  • 4
  • 26
  • 32
4
votes
2 answers

How to have Yocto build Module fcntl as part of Python Build

I used Yocto to build and install Python and python-twisted on Ubuntu x86, Raspberry Pi, BeagleBone Black, and a TI AM57XX EVM ( Dev Kit ). Python-Twisted has no problem importing all the aforementioned machines except for the AM57XX Dev Kit. It…
PhilBot
  • 748
  • 18
  • 85
  • 173
4
votes
1 answer

Python Twisted Client Connection Lost

I have this twisted client, which connects with a twisted server having an index. I ran this client from command-line. It worked fine. Now I modified it to run in loop (see main()) so that I can keep querying. But the client runs only once. Next…
Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
4
votes
1 answer

Python Twisted Client

I have this simple Twisted Client which connects to a Twisted server & queries an index. If you see fn. connectionMade() in class SpellClient, the query is hard-coded. Did that for testing purposes. How would one pass this query from outside to…
Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
4
votes
2 answers

Disable SSL certificate check Twisted Agents

I am using Twisted (16.3) and Treq (15.1) to make async requests in Python (2.7). I am having issues with some requests over HTTPS. Some sites have an invalid certificate and thus when making a request to them, I get…
mayk93
  • 1,489
  • 3
  • 17
  • 31
4
votes
2 answers

Is there any way to change the log message format in scrapy?

I would like to modify the scrapy log messages to contain user id at the beginning of it. for example, instead of this 2015-03-03 17:09:34+0530 [scrapy] INFO: Enabled spider middlewares: HttpErrorMiddleware, OffsiteMiddleware, RefererMiddleware,…
4
votes
0 answers

Deluge/Twisted script hangs after reactor.run()

This is a simple example script from dev.deluge-torrent.org for interacting with the Deluge API. Nothing happens after reactor.run() and I don't get the "Connection was successful" message, it just hangs forever. I ran this on my Ubuntu machine…
HaseebR7
  • 447
  • 4
  • 11
1
2 3
11 12