By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,772 Members | 937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,772 IT Pros & Developers. It's quick & easy.

Problem in generated files with makepy and Microsoft ADO

P: n/a
Hi,

when trying to generate the wrapper classes for Microsofts ADO Library
(Version 2.8) with makepy, I run into the following problem. Here's what I
do (I use ActiveState Python 2.4.1.245)

1.) Running makepy, selecting "Microsoft ActiveX Data Object 2.8"

2.) Starting PythonWin IDE

3.) When I type the following

import win32com.client.Dispatch
rs = win32com.client.Dispatch("ADODB.Recordset")

I get this error

Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File
"C:\Programme\Python24\Lib\site-packages\win32com\client\__init__.py", line
96, in Dispatch
return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo,
UnicodeToString, clsctx)
File
"C:\Programme\Python24\Lib\site-packages\win32com\client\__init__.py", line
38, in __WrapDispatch
klass = gencache.GetClassForCLSID(resultCLSID)
File
"C:\Programme\Python24\Lib\site-packages\win32com\client\gencache.py", line
184, in GetClassForCLSID
mod = GetModuleForCLSID(clsid)
File
"C:\Programme\Python24\Lib\site-packages\win32com\client\gencache.py", line
245, in GetModuleForCLSID
makepy.GenerateChildFromTypeLibSpec(sub_mod, info)
File "C:\Programme\Python24\lib\site-packages\win32com\client\makepy.py",
line 307, in GenerateChildFromTypeLibSpec
__import__("win32com.gen_py." + dir_name + "." + child)
File
"C:\Programme\Python24\lib\site-packages\win32com\gen_py\2A75196C-D9EB-4129-B803-931327F72D5Cx0x2x8\_Recordset.py",
line 55
def Collect(self, Index=defaultNamedNotOptArg):
return self._ApplyTypes_(-8, 2, (12, 0), ((12, 1),), 'Collect',
None,Index)
^
SyntaxError: invalid syntax

The Line containing the error reads as follows (in the generated
_Recordset.py file)

# The method Collect is actually a property, but must be used as a method
to correctly pass the arguments
def Collect(self, Index=defaultNamedNotOptArg):
return self._ApplyTypes_(-8, 2, (12, 0), ((12, 1),), 'Collect',
None,Index)

Strangely, if I delete the comment line, everything runs fine! I've noticed
a similar problem with the Properties.py file when I was using the adodbapi
module: There I had to delete the generated line

from win32com.client import Dispatch

which also seems perfectly correct to me.

I cannot see any error in the code. As I would like to deploy my application
without having my customer to edit this line manually I would appreciate any
hint (compiler bug? Bug in the ADO type library?)!

Thanks in advance

Martin
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Martin Stettner" <ma*********@complement.xxx.at> schrieb im Newsbeitrag
news:d8**********@newsreader1.utanet.at...
Hi,

when trying to generate the wrapper classes for Microsofts ADO Library
[bigsnip...]
Martin

Ok, I found some references to similar bugs at

http://www.python.org/sf/1163244,
http://www.python.org/sf/1089395 and
http://www.python.org/sf/1101726.
It seems that Python 2.4.1 has problems with mbcs encodint. I'll try to
install the actual version of the pywin32 package (build 204) which seems to
implement a workaround.cuMartin
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.