473,322 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

serving html from a python script in IE

I'm writing a script that outputs html. It works fine in Firefox,
however, IE wants to download the file instead of displaying the
output. I keep getting the file download dialog instead of the html
page.

I am doing something like this:

print 'Content-Type: text/html ; charset=utf-8\nCache-Control: no-cache
\n'
print '<html><body>some text and html</body></html>'

I also tried various things in .htaccess which has the following line:

AddHandler cgi-script .py

Any help will be appreciated.

Nov 1 '07 #1
4 1555
On Nov 1, 9:52 am, bluegray <bluegraydra...@gmail.comwrote:
I'm writing a script that outputs html. It works fine in Firefox,
however, IE wants to download the file instead of displaying the
output. I keep getting the file download dialog instead of the html
page.

I am doing something like this:

print 'Content-Type: text/html ; charset=utf-8\nCache-Control: no-cache
\n'
print '<html><body>some text and html</body></html>'

I also tried various things in .htaccess which has the following line:

AddHandler cgi-script .py

Any help will be appreciated.
Do you have the "shebang" listed at the top of your code (i.e. #!/path/
to/python)? Are you importing the cgi module at the top of your code?
>From what I've read, you don't need to modify the htaccess file...
See also:

Tutorials:
http://www.cs.virginia.edu/~lab2q/
http://wiki.python.org/moin/CgiScripts
http://www.upriss.org.uk/python/PythonCourse.html

Docs:
http://www.python.org/doc/essays/ppt/sd99east/index.htm
http://docs.python.org/lib/module-cgi.html

Mike

Nov 1 '07 #2

"bluegray" <fr************@gmail.comwrote in message
news:11**********************@k35g2000prh.googlegr oups.com...
print "Content-Type: application/xhtml+xml
That's your problem. You can't use that Mime type
because IE doesn't support XHMTL. No "appendix C"
hair splitting comments, please.
Nov 1 '07 #3
bluegray wrote:
I'm writing a script that outputs html. It works fine in Firefox,
however, IE wants to download the file instead of displaying the
output. I keep getting the file download dialog instead of the html
page.

I am doing something like this:

print 'Content-Type: text/html ; charset=utf-8\nCache-Control: no-cache
\n'
print '<html><body>some text and html</body></html>'

I also tried various things in .htaccess which has the following line:

AddHandler cgi-script .py

Any help will be appreciated.

If you take out the space between text/html and ; it works just fine.

(In other words, there is no mime-type "text/html ")

Cheers,
Cliff

Nov 1 '07 #4
If you take out the space between text/html and ; it works just fine.
>
(In other words, there is no mime-type "text/html ")
Thanks! That did it. What a difference a space makes ;)

Nov 1 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: -[ CaMeL ]- a55m0nk | last post by:
Hi there i am creating a clan website in ASP and am making a page serving script a link sends a query to the default page and then serves the page by grabbing the HTML from a database that...
1
by: Matthew Flower | last post by:
I'd like to generate a JavaScript file from a servlet. Mozilla 1.5 seems to have no problem with this, but IE 6.0 is not cooperating. I've created a very simple test servlet that writes one...
1
by: cwdjrxyz | last post by:
I am now writing many new pages in xhtml 1.1. They are served as true xhtml by setting the mime type of the server to application/xhtml+xml for the .xhtml extension. Since IE6 and some earlier...
21
by: Nicholas Sherlock | last post by:
Hey all, People on my website register to be allowed access to certain downloads. I store these files above the document root so that they can't be accessed by Apache (Only from PHP). I wrote a...
4
by: dreadrocksean | last post by:
the subject is a bit misleading. this is my situation: right now i have my "Gig" database (im a musician) in FMPro. i want this online so heres what i do now: 1/ i manually run a simple script...
1
by: Ben | last post by:
Hi there, Perhaps someone can help me. For some reason, when my Python script runs and loads an HTML page in a new browser window at the local host (desktop), the links to my stylesheet and all...
3
by: Sander Tekelenburg | last post by:
Situation: I store news articles as individual PHP files. Each file contains HTML and now and then some embedded PHP snippets. Serving those news articles on the Web works fine, through...
2
by: AeonOfTime | last post by:
Hi everyone, I am working on a project where I have .wmv files stored outside of the server's www root, and want to serve them via a custom web interface. It's all on windows, and is only...
4
by: iceanfire | last post by:
On the backend I have a python script that gets two pieces of information from the database: 1. html 2. xml file The javascript is supposed to : 1. inject the html file into a div 2. use the...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.