n00b> def openDb(self): n00b> try: n00b> self.db = MySQLdb.connect(host = self.db_host, n00b> user = self.db_uname, n00b> passwd = self.db_passwd, n00b> db = self.db_name, n00b> ) n00b> n00b> self.cur = self.db.cursor() n00b> return self.db, self.cur n00b> except Exception, e: n00b> sys.stdout = sys.__stdout__ n00b> sys.stderr = sys.__stderr__ n00b> print e[0], e[1] n00b> sys.exit(1) ... n00b> def write(self, string): n00b> s = string.strip('\n') n00b> if not s=='': n00b> self.openDb() n00b> self.cur.execute(self.sql, (s)) n00b> self.db.commit() n00b> self.closeDb()
You don't really want to open a new database connection for every write call do you? -- Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/ -- http://mail.python.org/mailman/listinfo/python-list