[Newbie Problems] AttributeError from CGI script?

steve_w at localhost.localdomain steve_w at localhost.localdomain
Sun Jan 30 07:34:14 EST 2000


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


Doug Stanfield wrote:
>Its just a guess, but make sure you haven't made an assignment to string
>someplace in your code.  In other words, I'm guessing you've done the
>equivalent of:
>
>[dougs at lawehana dougs]$ python
>Python 1.5.2 (#1, Apr 18 1999, 16:03:16)  [GCC pgcc-2.91.60 19981201
>(egcs-1.1.1  on linux2
>Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>>> import string
>>>> line = "the placeholder"
>>>> string = "gum up"
>>>> line = string.replace(line,"placeholder","works")
>Traceback (innermost last):
>  File "<stdin>", line 1, in ?
>AttributeError: 'string' object has no attribute 'replace'
>
>I'm guessing because my error message is somewhat different.  It sometimes
>helps to know what platform and version you're using, and usually adding the
>least amount of code that duplicates the error helps also.
>
>Hope this helps.
>
>-Doug-
>
>> 
>> 
>> I'm trying to use Python in a CGI script for the first time and 
>> have run into a problem I don't understand.  I get the subject
>> error message when trying to do a string.replace using one of
>> the values returned by the form that trigers the script.
>> 
>> The line of code looks like:
>> 
>> line = string.replace(line,"placeholder",form["target"].value)
>> 
>> I get an error message back saying:
>> 
>> Traceback (innermost last):
>> File "[my script's file name]"
>>    line = string.replace(line,"placeholder",form["target"].value)
>> AttributeError: replace
>> 
>> Could someone help me figure out what this error message means?
>> 



More information about the Python-list mailing list