Problem with response object

Steve Holden steve at holdenweb.com
Sat Sep 3 01:54:28 EDT 2005


Harish Kotian wrote:
> Hi Steve
> I copied the lines from your mail and again got the error.
> I am only pasting the relevant error lines below.
> 
> • Error Type:
> Python ActiveX Scripting Engine (0x80020009)
> Traceback (most recent call last): File "<Script Block >", line 1, in ? 
> response.redirect("http://www.holdenweb.com/") NameError: name 
> 'response' is not
> defined
> /test/test7.asp, line 3
> response.redirect("http://www.holdenweb.com/")
> 
> The code now reads as below
> <%@ LANGUAGE = Python%>
> <%
> response.redirect("http://www.holdenweb.com/")
> 
> %>
> 
> 
> ----- Original Message ----- From: "Steve Holden" <steve at holdenweb.com>
> To: "Harish Kotian" <hpkotian at rbi.org.in>
> Cc: <python-list at python.org>
> Sent: Saturday, September 03, 2005 10:42 AM
> Subject: Re: Problem with response object
> 
> 
>> Harish Kotian wrote:
>>
>>> Hi Steve
>>> Thank you for getting back. I suspect I am having problem with the 
>>> response object in Python.
>>>  I also tried with response.write it didn't work.
>>> I pasted your code into my page and tried it. I am again pasting the 
>>> code followed by the error page.
>>> I shall be grateful if you can figure  out the problem.
>>> harish.
>>> <%@ LANGUAGE = Python%>
>>>  <%
>>>      response.redirect("http://yahoo.com/")
>>
>> ^^^^^^^
>>
>>>
>>> %>
>>> The page cannot be displayed
>>>  The page cannot be displayed
>>>  There is a problem with the page you are trying to reach and it 
>>> cannot be displayed.
>>>  Please try the following:
>>> List of 2 items
>>> • Click the
>>> Refresh
>>> button, or try again later.
>>> • Open the
>>> kotian
>>> home page, and then look for links to the information you want.
>>> list end
>>>  HTTP 500.100 - Internal Server Error - ASP error
>>> Internet Information Services
>>>  Technical Information (for support personnel)
>>> List of 5 items
>>> • Error Type:
>>> Python ActiveX Scripting Engine (0x80020009)
>>> invalid syntax
>>> /test/test7.asp, line 4, column 4
>>> response.redirect("http://yahoo.com/")
>>> ---^
>>>  • Browser Type:
>>> Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 
>>> 1.1.4322)
>>>  • Page:
>>> GET /test/test7.asp
>>>  • Time:
>>> Saturday, September 03, 2005, 10:32:03 AM
>>>  • More information:
>>> Microsoft Support
>>>  list end
>>>
>> The traceback explains the problem: Python programs must start with no 
>> indentation. Even when writing in ASP code-brackets (<% ... %>) each 
>> code block must be a valid Python snippet.
>>
>> Also each code block stands alone, so you start afresh with no 
>> indentation whenever you open a new code-bracket. Try
>>
>> <%
>> response.redirect("http://www.holdenweb.com/")
>> %>
>>
OK. This is excellent. You will notice you are no longer receiving 
syntax error reports. It may not seem like it, but this is progress! 
Could you now try

<%
Response.Redirect("http://www.holdenweb.com/")
%>

Hint: Python is case-sensitive.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC             http://www.holdenweb.com/



More information about the Python-list mailing list