I have a long running python cgi which in the end returns a link to a
pdf file. While it runs it generates a log that uses stdout right into
the html. I use the sys.stdout.flus h() to make this log output
relatively realtime.
The log, however, has grown too long. I wish to output it instead
into a textarea. I thought I could just use the textarea tags before
the output starts. This works, but my output is no longer "real time"
even with the flush (it waits till I close the textarea tag to display
it). Anyone know a method how I can make it write to the textarea as
it goes?
Thanks,
Mark 2 2546
On Mon, 11 Oct 2004 14:18:26 -0700, LarsenMTL wrote: I have a long running python cgi which in the end returns a link to a pdf file. While it runs it generates a log that uses stdout right into the html. I use the sys.stdout.flus h() to make this log output relatively realtime.
The log, however, has grown too long. I wish to output it instead into a textarea. I thought I could just use the textarea tags before the output starts. This works, but my output is no longer "real time" even with the flush (it waits till I close the textarea tag to display it). Anyone know a method how I can make it write to the textarea as it goes?
You're fighting HTTP and HTML, which just aren't designed for this sort of
thing. Even your "relatively realtime" former implementation is an
accident; at any time any browser could choose to do more buffering and
un-real-time your log.
You're not likely to get more out of the solution than you already have.
Either trim the log, or, if it is getting long because it has to do more
that takes more time, tell the user their request has been accepted, and
email them when it is done. This is a common solution to this problem.
If you want to get crazy, fire the process off somehow, and create a way
for it to give status reports, and use client-side Javascript, with
XMLHTTPRequest, to read off the status periodically. This can in theory be
made cross-browser but I have no idea how true that is. la*****@yahoo.c om (LarsenMTL) wrote in message news:<99******* *************** ****@posting.go ogle.com>... I have a long running python cgi which in the end returns a link to a pdf file. While it runs it generates a log that uses stdout right into the html. I use the sys.stdout.flus h() to make this log output relatively realtime.
The log, however, has grown too long. I wish to output it instead into a textarea. I thought I could just use the textarea tags before the output starts. This works, but my output is no longer "real time" even with the flush (it waits till I close the textarea tag to display it). Anyone know a method how I can make it write to the textarea as it goes?
Thanks,
Mark
Using javascript to read the data and insert it into the text box,
with a regular refresh sounds like the way forward. *OR* close a
textarea tag every few k of text and start a new box....
Regards,
Fuzzy http://www.voidspace.org.uk/atlantib...thonutils.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: David Opstad |
last post by:
I have a question about text rendering I'm hoping someone here can
answer. Is there a way of doing linguistically correct rendering of
Unicode strings in Python? In simple cases like Latin or Japanese I can
just print the string and see the correct results. However, I don't know
how to get Python to do the right thing for writing systems which
require contextual processing.
For example, let's say I create this Unicode string in Arabic:
...
|
by: Tran Tuan Anh |
last post by:
Dear all:
I need your advice on this matter. I am working on a program which
takes some pieces of System-C code in and generate some other System-C
code. (System-C code is just C++ with some special libraries, hence
you can consider it as C++).
Right now, the generator program is written in C++. And I feel not so
comfortable with C++. I feel C++ is an overkill. Because, I need to
generate some code, hence in the program there are a...
|
by: Avi Berkovich |
last post by:
Hello,
I was unable to use popen2.popen4 to grab python.exe's (2.3) output, for
starts, it doesn't show the version information at the beginning and
won't return anything when writing to the stdin pipe, it seems that if I
give it some error nous expression, the pipe would return the exception
data, though nothing else comes through.
A friend of mine also tried this using win32api on delphi, and got the
same result.
|
by: j_macaroni |
last post by:
I know you can start php -a and go into interactive mode. This works
well exept you have to keep putting <?php code here ; bla blah code ;
Couple of problems with this.
1) Exits php when you make an error.
2) When you type a command; it displays the result but does not do an
automatic CR/LF
|
by: Adrian Smith |
last post by:
This may be more a cgi thing than a Python one, but I'm trying to get
this page:
http://adrian10.phpwebhosting.com/trial.html
consisting basically of this:
<FORM ACTION="/cgi-bin/python3.cgi" METHOD="POST">
<TEXTAREA NAME="essay" COLS=60 ROWS=20 WRAP=HARD></TEXTAREA>
<P><INPUT TYPE=SUBMIT VALUE="submit" NAME="submitbutton">
| |
by: Adrian Smith |
last post by:
While waiting for my paid-for web-hosting company to get back to me
about my difficulties running python scripts on their servers...
http://groups.google.com/group/comp.lang.python/browse_frm/thread/39b52bcf0dffec4c/4ff805bf283acc15?lnk=gst&q=adrian+smith&rnum=1&hl=en#4ff805bf283acc15
....I went and found a free one as a stopgap. And it worked! I was as
happy as a clam. But then it stopped working. Ah. I stripped the
script down to the same...
|
by: Peter Nimmo |
last post by:
Hi,
I am writting a windows application that I want to be able to act as if
it where a Console application in certain circumstances, such as error
logging.
Whilst I have nearly got it, it doesn't seem to write to the screen in
the way I would expect.
The output is:
|
by: socialanxiety |
last post by:
i hope someone here can help me.
basically, me and my friend have a summer project.
in this project, we need something that would basically function as a
blender. we know we'll need to buy a motor that spins, but what we're
having trouble with is figuring out how to program it. we want to be
able to control the speed of the motor. how would we accomplish this?
i'm new to all of this, so i'm having a hard time wrapping my mind
|
by: fordie1000 |
last post by:
Hi,
I have been trying to do this for a few days now ... I'd appreciate any help or insights ...
Basically I want to enter text into a web 'textarea' automatically ... here is what I
thought I should have ...
import urllib
import urllib2
import cookielib
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |