Hello,
basically I rewrote an example by Mark Hammond trying to create a
simple trial COM server as per his Python programming on Win32 book
The problem is that when run from VB6 (Excel VBA) it gives me an error

exceptions.typeerror
ReturnAmount() takes no arguments (1 given)

Google search gives me something like I am calling unbound method.
I am quite new in Python so please help

my code here:

# SimpleCOMServer.py - A sample COM server - almost as small as they come!
#
# We simply expose a single method in a Python COM object.
class Profit(object):
   _public_methods_ = [ 'ReturnAmount' ]
   _reg_progid_ = "Aivars.ReturnSaldo"
   # NEVER copy the following ID
   # Use "print pythoncom.CreateGuid()" to make a new one.
   _reg_clsid_ = "{599E3E04-5AEA-4541-B180-CED64F2A71BE}"


   def ReturnAmount(self):
       import sqlite3

       con = sqlite3.connect("e://pythonexamples//aivars2.db")
       cur = con.cursor()

       konts='71302'
       d1='2008-01-01'
       d2='2008-09-30'



       cur.execute("select coalesce(sum(summa),0) as AD from so2
where deb = (?) and date(datums) between (?) and (?)", \
           (konts, d1, d2))

       ret=cur.fetchone()
       r=ret[0]
       return r
       cur.close()
       con.commit()
       con.close()


# Add code so that when this script is run by
# Python.exe, it self-registers.
if __name__=='__main__':
   print "Registering COM server..."
   import win32com.server.register
   win32com.server.register.UseCommandLine(Profit)

thanks a lot

aivars
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to