Problem with response object

Steve Holden steve at holdenweb.com
Sat Sep 3 07:12:08 CEST 2005


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/")
%>

and see if that works.

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