Changes in win32api v2to3? Can import it fine in Python v3 but throws an
error in v2
I have been working with Python over the last few months, writing a few
apps in version 3.3 I now need to write an app that references modules
only in v2, so I'm starting to work with Python 2.7.5 I wrote a similar
app in v3, so I thought I'd start there by modifying some of the code I
uses in 3.3 to 2.7.5
However, I am at the VERY beginning and am already stumped. I downloaded
python 2.7 as well as pywin32 for 2.7. However, I am getting an import
error involving the win32api module, which is needed for win32com.client.
Here's the code I used in 3.3, which works
from win32com.client import Dispatch
from adodbapi import *
from time import sleep
import os
import xml.etree.ElementTree as ET
import urllib
import string
import csv
from urllib.request import urlopen
from xml.sax.saxutils import escape
from urllib.parse import urlencode
from urllib.parse import quote
Here's the code from 2.7, which does not work (I've commented out the
specific urllib requests because I know those changed from 2to3 and
haven't gotten to them yet)
from win32com.client import Dispatch
import adodbapi
from time import sleep
import os
import xml.etree.ElementTree as ET
import urllib, urllib2
import string
import csv
#from urllib.request import urlopen
#from xml.sax.saxutils import escape
#from urllib.parse import urlencode
#from urllib.parse import quote
The specific error I get is
Traceback (most recent call last):
File "C:\Users\...", line 1, in <module>
from win32com.client import Dispatch
File "C:\Python27\lib\site-packages\win32com\__init__.py", line 5, in
<module>
import win32api, sys, os
ImportError: DLL load failed: The specified module could not be found.
when I run
help ('modules')
in 2.7.5, I see that win32api does exist and is found by PYTHONPATH. I can
import sys & os without issue. The issue definitely lies with win32api.
This seems so basic. What am I missing??
No comments:
Post a Comment