home Mail List
Info
Info
Meetings
Goals
Upcoming
Projects
FAQ
Security
Links

[Date Prev][Date Next] [Chronological] [Thread] [Top]

[NMLUG] Python tight loop causing massive CPU barfage



You're probably trying to run it directly as a script rather than via 
python, as in:

python myscript.py

Put a:

#!/usr/bin/env python

as the very first thing in the file, and then you'll be able to run it 
directly, as in:

./myscript.py

Assuming you've put it in a file named myscript.py and you've kept the 
indentation correct.

The script is enclosed as a file here for your convenience:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: myscript.py
Type: application/octet-stream
Size: 1131 bytes
Desc: not available
Url : http://lists.b9.com/pipermail/nmlug/attachments/20050209/db3df358/myscript.obj
-------------- next part --------------


On Feb 9, 2005, at 6:43 PM, Paul Tietjens wrote:

> Peter Espen wrote:
>> The following python code searched a heiarchy of 28,517 directories 
>> and 222,766 files.  For each "regular" file found, it opened and 
>> searched the first 1024 lines for any line beginning with 'Subject'.
>> Ran in 7 minutes 13 seconds on a fast linux system.
>
> I've played with it, and so far the only output I can get from it is:
>
> line 6: syntax error near unexpected token `foo('
> line 6: `def foo( total, dirname, filelist):'
> _______________________________________________
> NMLUG mailing list
> NMLUG@nmlug.org
> http://www.nmlug.org/mailman/listinfo/nmlug
>



Please send sugestions and comments to webmaster@nmlug.org.
Valid XHTML 1.1! Valid CSS! Powered by Debian Powered by Apache