Python and ASP

T

Tempo

I recently uploaded a sample ASP-Python page to my web server and it
didn't show up correctly. Before I explain what it did, I should
mention that I got the same result when I tried to view the page from
my desktop (winxp user). So when I tried to view the sample ASP with
Python page from my desktop and web server, all that showed up was the
source code. I'm not sure exactly what this means since I know that
python 2.4 is installed on my computer and the ASP page still didn't
show up correctly. Here's the sample ASP-Python code, courtesy of
http://www.4guysfromrolla.com/webtech/082201-1.shtml :


<html>
<head>
<title>ASP-Python Test Page</title>
</head>
<body>
<%@ Language=Python %>
<%
Response.Write("Python lives in the ASP delimeters!")
%>
<br />

<script language="Python">
document.write("Python's throwing a party on the client-side!")
</script>
<br />

<script language="Python" runat="server">
Response.Write("Python gets ready to rumble inside a server-side
scripting block!")
</script>
</body>
</html>




Any ideas about what I am doing wrong? Thanks.
 
A

Atanas Banov

Did you save it with ".asp" extension?
Is the directory enabled to run scripts?
Can you run any other server-side script snippet (say VBscript)?
 
R

Roger Upole

It looks like you have a space before the first Response.Write.
This works fine for me if that line is left-justified.

hth
Roger
 
T

Tempo

It still doesn't work. I fixed that one error that you pointed out
Roger Upole, but it still isn't working. All I did was copy and past
the code above, plus Roger's fix, into Notepad2 and saved it as a
'.asp'. When I opened it in Firefox, all that showed up was the source
code of the file. It seems like it is reading the '.asp' file as a text
file in the web browser. Any further ideas? Thanks.
 
T

Tempo

What do you mean? I can't just upload the file to the server that is
going to host my site?
 
R

Roger Upole

No, what I mean is that until you upload the file to the web server and
request it back thru the server, it's just a text source file. However,
let me make sure I understood your previous post. I had thought
you meant you were opening the ASP file directly, as in locally and
not from a web service.
Did I read that right ?

Roger
 
S

Steve Holden

Tempo said:
What do you mean? I can't just upload the file to the server that is
going to host my site?
Note that the language identifier directive

<%@ Language=Python %>

should come right at the top of the file to do any good.

Is this an ISP-managed web server? If so it's possible that they haven't
(and may not want to) installed the Active Scripting features of Python
that come with the win32all extensions.

I can't remember offhand whether a separate step is necessary after
installing win32all, but without those extensions IIS just won't
recognize Python as an Active Scripting language.

regards
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top