Problem in generated files with makepy and Microsoft ADO

Discussion in 'Python' started by Martin Stettner, Jun 10, 2005.

  1. 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
    Martin Stettner, Jun 10, 2005
    #1
    1. Advertising

  2. "Martin Stettner" <> schrieb im Newsbeitrag
    news:d8bne1$908$...
    > 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
    Martin Stettner, Jun 10, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman
    Replies:
    1
    Views:
    1,323
    smith
    Dec 8, 2004
  2. SpamProof
    Replies:
    0
    Views:
    530
    SpamProof
    Oct 21, 2003
  3. Alv Mart

    ADO and Makepy

    Alv Mart, Nov 12, 2003, in forum: Python
    Replies:
    1
    Views:
    335
    Mark Hammond
    Nov 12, 2003
  4. Chris Curvey

    makepy, ADO and dynamic.py

    Chris Curvey, Sep 9, 2006, in forum: Python
    Replies:
    1
    Views:
    368
    Roger Upole
    Sep 10, 2006
  5. gundlach
    Replies:
    1
    Views:
    490
    gundlach
    Aug 5, 2008
Loading...

Share This Page