All pastes #75636 Raw Edit

Someone

public python v1 · immutable
#75636 ·published 2006-06-30 11:37 UTC
rendered paste body
from pysqlite2 import dbapi2 as sqliteimport os, sysmypath = os.path.dirname(os.path.abspath(__file__))databasedir = os.path.join(mypath, 'a.db')class DataBase(object):	databasedir = os.path.join( os.path.abspath(sys.argv[0]), 'brain.db')	def connect(self):		self.con = sqlite.connect(databasedir)		self.cur = con.cursor()		def show_commands(self):		self.connect()		self.cur.execute('SELECT command FROM knowledge')		a = ''		for output in self.cur.fetchall():			a += output + ' | '		return  a		def write_to(self, command, text):		self.connect()		self.cur.execute('INSERT INTO knowledge (command, text) VALUES (?, ?)', (command, text))		self.con.commit()				print ' *************************************\n'print mypath, '      ', databasedirprint ' *************************************\n'@@print DataBase.show_commands()print ' *************************************\n'Traceback (most recent call last):  File "a.py", line 32, in ?    print DataBase.show_commands()TypeError: unbound method show_commands() must be called with DataBase instance as first argument (got nothing instead)