473,782 Members | 2,454 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Script using generators produces different results when invokedas a CGI

En Mon, 05 May 2008 00:31:45 -0300, Barclay, Ken <Ke*********@sc hwab.comescribi ó:
I attended David Beazley's awe-inspiring tutorial on the use of
generators in systems programming:
http://www.dabeaz.com/generators/
<BLOCKED::htt p://www.dabeaz.com/generators/>
I used his approach to write a web tool that can display search results
from different log files. But the resulting script produced fewer
results when invoked as CGI than it did when run from the command line,
and I can't figure out why.
Problem: For small sets of files this works great. But when I had 19Meg
worth of log files in a test directory, the script would return the
correct number of matching lines (288) only when it was invoked directly
from the command line. When invoked from a CGI script, it returns 220
lines instead (written to the "tempfile", below.) I don't know where
that limit is coming from. If more logs are added to the test directory,
the result is always the same 220 lines.
I'm using Python 2.5.1 on Red Hat Linux 3.2.3-47. Below is the whole
script I was testing with. It's using hard-coded values in place of ones
I'll be getting from an HTML form (generated with HTMLgen) presented to
the user.
There are no exceptions or errors of any kind. Any pointers on what
might be happening here would be welcome!
No entry in the error log, on the web server? (Apache?)
Perhaps you're hitting some internal limit of the cgi process, either memory or cpu time per request or temp file size...
Are you sure the script runs to completion? Output a message at the end, to be sure.

--
Gabriel Genellina

Jun 27 '08 #1
1 1087
Gabriel Genellina <ga*******@yaho o.com.arwrote:
En Mon, 05 May 2008 00:31:45 -0300, Barclay, Ken <Ke*********@sc hwab.comescribi ó:
I attended David Beazley's awe-inspiring tutorial on the use of
generators in systems programming:
http://www.dabeaz.com/generators/
<BLOCKED::htt p://www.dabeaz.com/generators/>
I used his approach to write a web tool that can display search results
from different log files. But the resulting script produced fewer
results when invoked as CGI than it did when run from the command line,
and I can't figure out why.
Problem: For small sets of files this works great. But when I had 19Meg
worth of log files in a test directory, the script would return the
correct number of matching lines (288) only when it was invoked directly
from the command line. When invoked from a CGI script, it returns 220
lines instead

No entry in the error log, on the web server? (Apache?)
Perhaps you're hitting some internal limit of the cgi process, either memory or cpu time per request or temp file size...
Are you sure the script runs to completion? Output a message at the
end, to be sure.
Check the ownership of all the files too. Remember that the web
server (and hence your cgi) will likely run as nobody or www-data.
You are unlikely to be logging in as one of those users.
--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1953
by: Carlos Ribeiro | last post by:
As a side track of my latest investigations, I began to rely heavily on generators for some stuff where I would previsouly use a more conventional approach. Whenever I need to process a list, I'm tending towards the use of generators. One good example is if I want to print a report, or to work over a list with complex processing for each item. In both cases, a simple list comprehension can't be used. The conventional approach involves...
3
2287
by: Michael Sparks | last post by:
Hi, I'm posting a link to this since I hope it's of interest to people here :) I've written up the talk I gave at ACCU Python UK on the Kamaelia Framework, and it's been published as a BBC R&D White Paper and is available here: * http://www.bbc.co.uk/rd/pubs/whp/whp113.shtml
0
4073
by: Kevin Cheramie | last post by:
I'm unsure how to break down and use what is returned by expect in the rest of my script. I want to issue a command and split the results of that command into several different variables. I then want to use those variables in the rest of my script. Here is a snipet: $expcxn = Expect->spawn("telnet 10.10.10.10\r") or die "Cannot spawn telnet: $!\n\n"; $expcxn->expect($timeout, "assword:") or die "Did not get a password prompt: $!/n/n";...
3
1985
by: Faith | last post by:
Hi all, I have a serious problem that I am not sure whether its a bug in the Microsoft Visual C++ or something that I am doing wrong. The problem is (as noted in the Subject) is that my program behaves differently when I insert a break point in a certain function (or I step into it) I get different results. Its the same input and the same code!! I do not think that adding a source code here will help since its fairly a long program, but I...
24
3968
by: Lasse Vågsæther Karlsen | last post by:
I need to merge several sources of values into one stream of values. All of the sources are sorted already and I need to retrieve the values from them all in sorted order. In other words: s1 = s2 = s3 = for value in ???(s1, s2, s3):
2
1318
by: Tom Sheffler | last post by:
This may have been discussed before, so I apologize. Does Java have generators? I am aware of the "Iterator" interface, but it seems much more restrictive. Python generators are useful for many more things than simply list enumeration, but the Java Iterator seems limited. Tom
18
4568
by: jess.austin | last post by:
hi, This seems like a difficult question to answer through testing, so I'm hoping that someone will just know... Suppose I have the following generator, g: def f() i = 0 while True: yield i
34
13241
by: John | last post by:
This produces an initialized array to zero: int *i = new int() ; 004124B0 push ebp 004124B1 mov ebp,esp 004124B3 mov eax,dword ptr 004124B6 push eax 004124B7 call operator new (411212h) 004124BC add esp,4
9
2615
by: adamalton | last post by:
I've got a script which uses cURL to connect to another website, and it seems to be getting stuck (I can't quite figure out how, but that's besides the point!). The trouble is that when my script runs it redirects you to a "please wait" page, and it then executes by itself. So you can't click 'stop' in your browser to terminate the script. If the script gets a fatal error, then the 'results' page will display an error saying that the script...
0
9639
marktang
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...
0
9479
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10311
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
jinu1996
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...
0
9942
tracyyun
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...
0
8967
agi2029
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...
1
7492
isladogs
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...
0
6733
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();...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.