Python 3.2.3 and my blank page

Νίκος Γκρ33κ nikos.gr33k at gmail.com
Sun Mar 31 15:19:57 EDT 2013


I just tried the testmysql.py script:

#!/usr/bin/python3
# coding=utf-8

import cgitb; cgitb.enable()
import cgi, re, os, sys, socket, datetime, MySQLdb, locale, random, subprocess



# connect to database
con = MySQLdb.connect( db = 'nikos_metrites', host = 'localhost', user = 'nikos_nikos', passwd = 'tiabhp2r#', init_command='SET NAMES UTF8' )
cur = con.cursor()

print ( "Content-type: text/html; charset=utf-8\n" )


# =================================================================================================================
# if extra string is attached to the URL is 'log' then show explicit page log and exit
# =================================================================================================================

cur.execute('''SELECT hits FROM counters''')
data = cur.fetchall()        #URL is unique, so should only be one

for item in data:
	print( item )
===================


it works, as you can see at: http://superhost.gr/cgi-bin/testmysql.py

so MySQLdb mpodule does work for Python3 !!!!!

so mysql connector is not the problem.

but hwta is it then i get no errors!!



More information about the Python-list mailing list