M
Martin Stettner
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
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