[Newbie Problems] AttributeError from CGI script?
David Fisher
python at rose164.wuh.wustl.edu
Sun Jan 30 09:43:17 EST 2000
Ah, well that's easy then. In version 1.4, the string module doesn't
have a replace function. After importing string, a dir(string) will
give you a list of the module's attributes. Replace will not be in
that list, at least until the mythical upgrade <wink>, hence, the
AttributeError.
Here's the definition of replace chopped from string.py (version
1.5.2):
def replace(str, old, new, maxsplit=0):
return joinfields(splitfields(str, old, maxsplit), new)
joinfields and splitfields are defined in 1.4, so this should work.
On a side note, this function, while being defined in string.py is not
actually used. Along with most/all of the other functions in
string.py, it is replaced at the end of the module by another function
named replace from the strop module, which is written in C. Now why
this is done is a complete mystery to me.
David Fisher
>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
On 1/30/00, 6:34:14 AM, steve_w at localhost.localdomain () wrote
regarding Re: [Newbie Problems] AttributeError from CGI script?:
> I checked and I don't appear to be assigning anything to a variable
> call string. Thanks for the suggestion though. The server I'm
> working from is using Python 1.4 on Solaris 2.6. They promised
> me they'd upgrade a few weeks ago so it'd match my documentation
> and local version but so far no dice.
> To make matters worse I'm now getting some different error which seems
> to be from the CGI Wrapper software.
> Steve Wall
More information about the Python-list
mailing list