472,960 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,960 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 1542
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...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.