Thanks, Tim,

Your suggestions are OK but the code works called from IDLE - It does
not work when called from VB as a COM server.
Mark Hammond's example works for me perfectly. I cannot see what I am
doing wrong.

This is only a trial version and is definitely ugly.
The ReturnAmount will take arguments in future version so to speak.


this is how I call it from VB:

Sub testPython()

Dim a
Dim response


Set a = CreateObject("Aivars.ReturnSaldo")
response = a.ReturnAmount() '--->error here

Worksheets("Sheet1").Range("a1").Value = response
End Sub




2008/10/3 Tim Roberts <[EMAIL PROTECTED]>:
> aivars wrote:
>> 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)
>>
>
> It's true that your ReturnAmount function takes no arguments.  How did
> you call it?
>
>>        con = sqlite3.connect("e://pythonexamples//aivars2.db")
>>
>
> If you use forward slashes, just use one at a time.  If you use backward
> slashes, THEN you need to double them.
>
>>        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))
>>
>
> sqlite3 uses the ? method of parameter substitution.  You don't need
> those extra parentheses (that is, use ? not (?) ).  Also, you don't need
> the backslash at end of line; Python will keep continuing the statement
> as long as you are inside an open set of parentheses.
>
> --
> Tim Roberts, [EMAIL PROTECTED]
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to