SoulMazer 26 Posting Whiz in Training

Ugh, this is quite frustrating. I am writing a series of CGI scripts with Python that all work perfectly until I add in a stylesheet reference. Interestingly, if I put the styling rules inside the CGI script, it runs perfectly; it only throws an error when it is in an external stylesheet. I'm not sure if my "Exec format error: Premature end of script headers" error has to do with Python, so I apologize if this is not in the right forum. Sadly there is no HTML/CSS forum here, so I thought the Python forum would be sufficient.

Anyways, here is some of my Python code:

import cgi

print "Content-Type: text/html\n\n"

print "<html>"
print "<head>"
print "<link href='MyStylesheet.css' rel='stylesheet' type='text/css'>"
print "</head>"
print "<body>"
# Cut out
print "</body>"
print "</html>"


body {
    background-color: #000000;

 a:link { 
    text-decoration: none;
    line-height: 2.0;
    color: #F1F1F1;

 a:visited { 
    text-decoration: none;
    line-height: 2.0;
    color: #F1F1F1;

 #colored {
    background: #1B1B1B;

What's my problem here? Apache's error log says its my stylesheet, but I cannot see any problems with it. Maybe I just need some fresh eyes to look at it?

Thanks in advance everybody.

EDIT: Well, I guess I solved my own problem. Apparently Apache does not like having CSS files anywhere inside the cgi-bin directory. Moving the stylesheet to a different directory and calling it by its full path did the trick.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.