No module named new (216 - py3.1)
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
Using pywin32-216.win32-py3.1, i get the error :
File "C:\Python31\lib\site-packages\win32com\client\__init__.py", line 320, in WithEvents
import new
ImportError: No module named new
Can be corrected by replacing lines 320-324 :
import new
events_class = getevents(clsid)
if events_class is None:
raise ValueError("This COM object does not support events.")
result_class = new.classobj("COMEventClass", (events_class, user_event_class), {})
with :
try:
from types import ClassType as new_type
except ImportError:
new_type = type # py3k
events_class = getevents(clsid)
if events_class is None:
raise ValueError("This COM object does not support events.")
result_class = new_type("COMEventClass", (events_class, user_event_class), {})
Thanks! Fixed in rev 7f44ae5e7785