[Tutor] Trouble with script not parsing out text

Tim Finley gofinner at gmail.com
Thu Aug 30 00:46:02 CEST 2007


I get the following when running a script.

TypeError: argument 1 must be string or read-only character buffer, not _sre.SRE_Pattern

Here is the script I am trying to run.   I am trying to verify that my search is returning what I am trying to search for, but due to the error I can verify it.

import re

log = open('audit.log') # Opens audit log
log2 = open('timaudit.log','w')
for line in log:
    line =re.compile(r"""
        \w      #match any alphanumeric character
        \Audit report for user+
        \User reported as inactive+
        """, re.VERBOSE)
    line.search('Audit report for user () User reported as inactive')
    log2.write(line)

log.close()
log2.close()

Thank you,

Tim Finley
Novell IT Services Engineer
Novell Technical Services
Novell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070829/23eeea19/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: timaudit.log
Type: application/octet-stream
Size: 0 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20070829/23eeea19/attachment.obj 


More information about the Tutor mailing list