0

I would dearly love to use the adodbapi module, but I can't get it to import. The latest version for Python 3.2 32 bits appears to have a syntax error:

Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.5.4\helpers\pydev\pydevd.py", line 2358, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.5.4\helpers\pydev\pydevd.py", line 1778, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.5.4\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc) 
  File "C:/Customers/Calvert/Scripts/test_adodb.py", line 1, in <module>
    import adodbapi
  File "C:\Python32\lib\site-packages\adodbapi\__init__.py", line 16, in <module>
    from .apibase import apilevel, threadsafety, paramstyle
  File "C:\Python32\lib\site-packages\adodbapi\apibase.py", line 495
    raise er,'No such key as "%s" in %s'%(repr(key),self.__repr__()),tr

What do I have to do to get around this? Is this Python 2 syntax in a file designed for Python 3? The name of the file I downloaded from SourceForge is pywin32-220.win32-py3.2.exe, and it was dated 1/11/16.

2 Answers 2

0

Apparently, I was correct. This module, labeled for python 3.2, contains Python 2 code. I ran 2to3 on it, and the syntax error went away.

2
  • It is nice to see you where able to correct your problem ! Can you be a little more specific about "I ran 2to3 on it" ? I tried calling '2to3 -w -W adodbapi.py' but I still have the same error message.
    – Madgui
    Jul 25, 2019 at 16:21
  • I'm sorry, but that was over three and a half years ago, and I don't remember exactly what I did. Jul 25, 2019 at 20:11
0

It appears that the adodbapi codebase on both SourceForge (https://adodbapi.sourceforge.net/) and PyPy (https://pypi.org/project/adodbapi/2.4.2.1/) is either old and/or unmaintained. It appears to live on through pywin32.

So upon encountering this error, in stead of the answer above, I simply installed pywin32 in place of adodbapi and my code worked fine:

pip uninstall adodbapi
pip install pywin32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.