Questions tagged [tornado]
Tornado is a scalable web server and web framework for Python specializing in handling thousands of simultaneous connections and real-time services.
3,774
questions
1
vote
0
answers
15
views
how to initialize a different object for different sub-process of tornado-based application?
The following are my code:
class PromptHandler(tornado.web.RequestHandler):
def initialize(self, obj):
self.obj = obj
async def get(self):
self.write('OK')
def make_app(obj):
...
0
votes
0
answers
20
views
tornado ioloop profiling: measure the number of await performed by a given request handler
I've got an asynchronous request handler and I would like to know how many times my handler has relinquished execution to the ioloop, including nested coroutines it may have called (either in my code ...
0
votes
0
answers
9
views
How to improve the concurrency ability of multi-processing web server based on Tornado?
The following are my code sample.
async def job_run():
time.sleep(10) # probably calling an external API with long response time.
return "Finished."
class MyHandler(tornado.web....
0
votes
0
answers
11
views
Tornado - how to get error when a child process dies immediately?
I inherited an old Tornado project and am trying to update it. (I'm pointing out this context because it might not be set up according to current best practices.)
Right now, it calls tornado.process....
0
votes
1
answer
20
views
How does tornado deal with concurrency?
The tornado-based web application runs with 4 forking sub-processes as following.
async def post_fork_main():
app = tornado.web.Application([(r'/', MyHandler)])
server = tornado.httpserver....
0
votes
0
answers
12
views
Why tornado request timeout is caped to 30s
I'm making http post request with this function:
client = AsyncHTTPClient()
kwargs["method"] = "POST"
kwargs["validate_cert"] = False
kwargs["...
0
votes
1
answer
36
views
Tornado : How to properly close IOLoop with websocket?
I try to make some pretty nice things with Tornado in Python.
I have several threads with theses functions (simplified) :
def run(self):
self.io_loop = tornado.ioloop.IOLoop()
self.io_loop....
0
votes
1
answer
20
views
Tornado exit from a gen.sleep()
I want to exit from an existing gen.sleep state.
USer will send a HTTP POST with a param to trigger this method.
I use a Tornado loop to start a process which refresh some authentication/tokens every ...
0
votes
0
answers
28
views
Tornado async download to client error: Cannot send error response after headers written
I am trying to create a tornado web app for downloading local file from server to client through a html href. I am able to hit the download endpoint, something is not correct in my code. It takes 20 ...
0
votes
1
answer
12
views
How to link static files in Gramex sub folder URL properly
Created a tornado template template.html like so:
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-...
0
votes
0
answers
37
views
GameServer with python(Tornado 6 + pyMySQL) SQL Connection failed 255
Im trying bring to live this code
I fixed few things but im stuck on connect to mysql.
Game server use python 3.4 and old tornado 4.
I want rebuild code for newest pytohn and tornado.
I was installed ...
0
votes
0
answers
28
views
Does Tornado autoreload just restart the server?
I try to use autoreload option in Python server Tornado.
I've found in doc that autoreload automatically restarts the server: https://www.tornadoweb.org/en/stable/autoreload.html
But what if the ...
0
votes
0
answers
8
views
Python Tornado server stops when autoreload is applied
I try to set Python's Tornado server autoreload as stated here: https://gist.github.com/renaud/10356841
My part of code with autoreload settings is:
if __name__ == "__main__":
...
0
votes
0
answers
30
views
Tornado web "AttributeError: '_NullFuture' object has no attribute 'add_done_callback' error
I deployed tornado web with these versions.
Ubuntu 18.04
Python 3.11.4
Tornado 6.3.2
Error message:
[E 230620 15:07:01 http1connection:67] Uncaught exception
Traceback (most recent call last):
...
1
vote
0
answers
19
views
Tornado subroutines handling POST
I want to call a HTTP handler and from there start a process. This process is a while loop that calls a specific method and needs to run asynchronously every 5 minutes or so.
import logging
import ...
0
votes
1
answer
39
views
Python tornado multiple rangesliders javascript accessing last instance
I am building a tornado application in which I want to update the values of multiple independent range sliders within a form. The problem with my current code is that I only seem to access the last ...
0
votes
1
answer
38
views
How can I make tornado web return 403 if current_user is None instead of redirect to login_url?
Following is the implementation of method authenticated:
def authenticated(
method: Callable[..., Optional[Awaitable[None]]]
) -> Callable[..., Optional[Awaitable[None]]]:
"...
0
votes
1
answer
159
views
Jupyter notebook unable to connect to kernel
Something has become messed up in a way that I don't understand.
I've been installing a lot of packages today and read that the error below may have been caused by installing an older version of ...
0
votes
0
answers
112
views
My Kernel always dies in the same spot (in Jupyter Notebook)
I have to say that I'm not really knowledgeable at coding since I'm learning by myself how to use Python through Jupyter Notebook to do data analysis. Given that, I'm not able to understand why my ...
0
votes
1
answer
37
views
Unable to recover from an exception in tornado_sqlalchemy
I'm using tornado_sqlalchemy to manage my sessions, this is due to many issues I had when running regular sqlalchemy myself which I had to manage.
I load my Tornado server like so:
app = tornado.web....
2
votes
1
answer
54
views
How to get out of a while loop in tornado
The server.py uses the Python Web Framework, tornado.
I want to create a program that sends the stock selected from the pull-down menu in client.html to server.py, retrieves the corresponding stock ...
0
votes
0
answers
23
views
Why cannot use python3 to import the class "PollIOLoop" from tornado.ioloop?
I encountered a problem when importing the class "PollIOLoop" from tornado.ioloop, I don't know how to use, just need it in one file. The original code is "from tornado.ioloop import ...
0
votes
1
answer
32
views
Why a change in routing policy in tornado results in sending Type Error?
I am trying to change the whole webpages from serving on absolute path to relative path, but something went wrong as the request goes to the back-end tornado 5.0 server.
The javascript is like this:
...
0
votes
0
answers
76
views
how to embed bokeh plot into html
I am working with bokeh library in python to generate charts like bar chart , histogram , line chart for visualization of data.
Our code was developed in bokeh version 1.4.0. Now, I want to upgrade ...
0
votes
1
answer
32
views
How to test subclass of tornado.web.RequestHandler without using AsyncTestCase or AsyncHTTPTestCase (since they're deprecated)?
I've got a subclass of tornado.web.RequestHandler, but the common test-cases are deprecated as of 6.2. Most resources I've found (including many questions on StackOverflow) use the deprecated classes, ...
0
votes
0
answers
35
views
Dynamodb in Python Tornado Framework
Is it possible to use dynamodb in the tornado async flow using @gen.coroutine and yield?
from tornado import gen
import aioboto3
@gen.coroutine
def test():
data = {}
session = aioboto3....
2
votes
1
answer
74
views
_UnixSelectorEventLoop has no attribute _closed (nor other instance attributes) while being deleted in Jupyter Notebook
There are a few questions similiar to this but not a duplicate I could find.
I'm doing some automatic unit testing of Python code and running these tests in a Jupyter Notebook. On certain computers (...
0
votes
0
answers
1k
views
Bokeh: How to access file from a Bokeh server which started from within the script itself (standalone/embedded server)
I am currently developing a Bokeh dashboard to display pdfs. When starting the bokeh server from within the script itself, I have trouble accessing local files.
My directory structure looks as follows:...
0
votes
0
answers
46
views
Websocket Python Tornado server with Dataplicity
I want to create a websocket server on raspi with tornado python. So made that code :
#! /usr/bin/python
import os.path
import tornado.httpserver
import tornado.websocket
import tornado.ioloop
import ...
0
votes
0
answers
61
views
Access django session and user asynch/in different (unix) process
I'd like to integrate a streamlit application - streamlit is based on tornado - into django via an <iframe>, while ensuring that streamlit requests only go through if there is an authenticated ...
0
votes
0
answers
36
views
how to reuse response the db rows and values when using tornado-sqlalchemy
According to the tornado_sqlalchemy docs i'm suppose to use the session like so:
from tornado_sqlalchemy import SessionMixin
class MyPage(SessionMixin, tornado.web.RequestHandler):
async def ...
0
votes
0
answers
56
views
Update a slow-loading variable in Tornado without blocking REST responsiveness
I'm trying to run Tornado REST that returns data from a very large DataFrame.
Because the data changes frequently, I'd like to update the DataFrame frequently in the backgroundwithout blocking the ...
2
votes
0
answers
76
views
I get no response when using curl_httpclient in Tornado, the app hangs pending, what am I missing?
os: Debian 11 - minimal install, (SSH Server and Standard system utilities)
curl -V
curl 7.74.0 (x86_64-pc-linux-gnu) libcurl/7.74.0 OpenSSL/1.1.1n zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 ...
0
votes
0
answers
90
views
Getting this error when accessing Panel Dashboard on different computer in a network
I have deployed a panel app on IIS using reverse proxy method but when accessing the same I get the following error and the dashboard seems to be incompletely loaded in browser
Exception in callback &...
0
votes
1
answer
49
views
What do I need to change so my tornado code can post successfully?
I have the following (with some strings modified) which works when using the requests library.
import requests
from pprint import pprint
import json
PEM = '/full/path/to/my.pem'
client_id='cliendID'
...
0
votes
0
answers
63
views
how to communicate between regular MQTT and tornado websocket?
Is there any way to make a mqtt client send messages to tornado websocket?
Using this code, tornado works. While from MQTT no message passes.
import os.path
import tornado.httpserver
import tornado....
0
votes
0
answers
126
views
Loading custom MapBox GL JS tile source generated with Python tornado async RequestHandler
I created custom tile source provider with python running tornado web server. On the server I generate on the fly the specific tile and output it as a "image/png" header format. To prevent ...
0
votes
0
answers
53
views
Tornado Framework - how to use Handlersrequest to call an asynchronous function
This is a Python code for a Tornado web application. The code defines two classes, BaseHandler and MainHandlerIndex, both of which inherit from the Tornado web library's RequestHandler. The ...
0
votes
0
answers
36
views
Unit testing @run_on_executor decorated functions?
I'm trying to find a less brittle way to test functions employing the run_on_executor decorator. My problem is that a unit test will typically run the decorated function, return and then carry out the ...
0
votes
1
answer
46
views
Parse .csv file in tornado web server
I'm trying to parse a .csv file using this code
class uploadHandler(tornado.web.RequestHandler):
def get(self):
self.render("index.html")
def post(self):
...
0
votes
0
answers
261
views
FastAPI: Task was destroyed but it is pending
I've been fighting asyncio + FastAPI for the last 48 hours. Any help would be appreciated. I'm registering an on_gift handler that parses gifts I care about and appends them to gift_queue. I'm then ...
0
votes
0
answers
13
views
How to manage torando's buffer
I have a tornado WebSocketHandler which I am using to send a message to my frontend. The problem is that whenever I have a slow connection to the device from where the data is being sent, I get a ...
0
votes
0
answers
33
views
To get tornado general log, shall add gen_log = logging.getLogger("tornado.general") to app.py file in which main method called
Will this print all tornado logs or do I need to add these in app.py file, did not understood how to log this tornado logs- gen_log=logging.getLogger("tornado.general") similarly access &...
0
votes
0
answers
51
views
Unwanted blank table row in Docmosis
I am using Docmosis to generate data into a table. A blank row appears underneath the table heading and between each row containing data.
I suspect my issue is occurring because of the statements ...
0
votes
0
answers
130
views
How to read file on server sent with Apollo GraphQL Rest Link?
I'm trying to upload a file from a React component using Apollo GraphQL's rest link ( which allows us to call REST APIs inside GraphQL queries). I'm able to send the file from the client to the server ...
0
votes
0
answers
63
views
Calling async function within Tornado overriden methods
I am trying to call async functions in tornado overriden methods.
Initially, the function generate() is syncronous, but that seems to block the entire program, including on_connection_close method
...
0
votes
0
answers
39
views
Running a tornado deamon in an interactive python interpreter
I'm trying to establish a websocket connection between to python processes using tornado. On client side, I'm restricted to using python 2.7 which means that I cannot make use of some sophisticated ...
0
votes
0
answers
557
views
Voila not displaying widgets due to tornado authorization error
I am trying to run this https://github.com/facebookresearch/aepsych/tree/main/visualizer visualization dashboard and I am able to run it with the jupyter notebook. I am running into an issue when I ...
0
votes
0
answers
158
views
Python Tornado: What is the correct way to launch background tasks so they can be gracefully closed on shutdown?
I am trying to support graceful shutdown for a Tornado application. I would like to stop receiving new requests and wait for the existing requests to complete before proceeding to close the ...
0
votes
1
answer
71
views
Timeout Tornado requests from point of receiving
I built a Tornado Webservice with receives and processes requests and Parses PDF Documents. The problem not is that if I want to load the PDF as an xml Tree, this operation takes very long and is CPU ...