[DB-SIG] document contains no data

Lloyd Kvam pythontutor at venix.com
Fri Jan 23 20:13:20 EST 2004


apache does not run your script by "saying"
	python <scriptname>
it simply executes your script.

Your script must be saved with execute permission
	chmod +x <scriptname>

Also the very FIRST line of the script must specify that you want
python to run the script.  This line will look something like:

#!/usr/bin/python

#!/usr/local/bin/python

is also quite common.  It MUST match your server configuration.


Also a script MUST print a line describing what kind of output is being
produced.  (You could be sending a picture or sound file for instance.)
This is done by printing:

print "Content-type: text/html\r\n\r\n"

Your case may actually be text/text.

The folks that administer the server should be able to help you with
these issues.


helena bhaska wrote:

> Thanks,
> hm, I don't think that it's a code problem, since I
> wrote it on a different machine, where it worked
> perfectly.  Then I transferred it to a different
> machine, where I'm running into this problem.  I
> thought I set it up exactly the same way as the other
> machine, but apparently not.  Do you know what that
> dialog box error means?
> Thanks.
> --- Marcos_Sánchez_Provencio <msanchez at grupoburke.com>
> wrote:
> 
>>Are you using cgi?
>>
>>Be sure to include the correct headers in your cgi.
>>Check also that the 
>>environment for the cgi (path, etc.) is the same as
>>for the user you are 
>>testing from. You may try to create a minimal cgi
>>first.
>>
>>
> 
> http://www.devshed.com/c/a/Python/Writing-CGI-Programs-in-Python/2/
> 
>>helena bhaska escribió:
>>
>>>Hi everybody,
>>>I am trying to connect to a database and read
>>>something from it in a program that runs under
>>
>>apache.
>>
>>>Here's my code:
>>>db = MySQLdb.Connect(host="host", user="usr",
>>>passwd="pswd", db="db")
>>>c = db.cursor()
>>>c.execute("""SELECT * FROM SomeTable""")
>>>results = c.fetchall()
>>>
>>>The execute statement causes the internet browser
>>
>>to
>>
>>>spit out a dialog box with a message "document
>>>contains no data"
>>>
>>>If I run these statements from python command
>>
>>line, it
>>
>>>works fine. 
>>>
>>>First of all, I would like what that message about
>>
>>no
>>
>>>data means...
>>>The apache error log gives me the following:
>>>[Thu Jan 22 17:49:58 2004] [notice] child pid 9186
>>>exit signal Segmentation fault (11) - which
>>
>>obviously
>>
>>>is bad, but I again don't know what this means.
>>>
>>>Thanks for any pointers.
>>>Helena
>>>
>>>
>>>__________________________________
>>>Do you Yahoo!?
>>>Yahoo! SiteBuilder - Free web site building tool.
>>
>>Try it!
>>
>>>http://webhosting.yahoo.com/ps/sb/
>>>
>>>_______________________________________________
>>>DB-SIG maillist  -  DB-SIG at python.org
>>>http://mail.python.org/mailman/listinfo/db-sig
>>
>>
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool. Try it!
> http://webhosting.yahoo.com/ps/sb/
> 
> _______________________________________________
> DB-SIG maillist  -  DB-SIG at python.org
> http://mail.python.org/mailman/listinfo/db-sig
> 

-- 
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice:	603-653-8139
fax:	801-459-9582




More information about the DB-SIG mailing list