Victor Subervi wrote: > Hi; > I have this code which works fine: > > #!/usr/local/bin/python > import _mysql > import MySQLdb, cPickle > host = 'mysqldb2.ehost-services.com <http://mysqldb2.ehost-services.com>' > user = 'user' > passwd = 'pass' > db = 'bre' > print 'Content-Type: image/jpeg\r\n' > print '<html><body>\nHi!\n' > connection = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db) > imgfile=open("1.jpg",'rb') > f = imgfile.read() > cursor = connection.cursor() > cursor.execute("CREATE TABLE justatest (name TEXT, ablob BLOB)") > names = 'aramis', 'athos', 'porthos' > data = {} > for name in names: > datum = list(name) > datum.sort() > data[name] = cPickle.dumps(datum, 1) > sql = "INSERT INTO justatest VALUES (%s, %s)" > cursor.execute(sql, ('ramis', _mysql.escape_string(f)) ) > imgfile.close() > connection.close() > print '\nBye!\n</body></html>' > Now, if I take out this part, which I canĀ“t see does anything at all in > the code, it no longer works: > > names = 'aramis', 'athos', 'porthos' > data = {} > for name in names: > datum = list(name) > datum.sort() > data[name] = cPickle.dumps(datum, 1) > Why? > TIA, > Victor > Define "no longer works".
regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list