Don't die if win32api doesn't exist.

This commit is contained in:
Guido van Rossum 1998-05-26 02:51:40 +00:00
parent 55b40b06d2
commit 0f1e1fc3fa
1 changed files with 6 additions and 1 deletions

View File

@ -20,7 +20,11 @@
but an obvious enhancement would be to provide command line options. but an obvious enhancement would be to provide command line options.
""" """
import os, win32api, string, sys import os, string, sys
try:
import win32api
except ImportError:
win32api = None # User has already been warned
class CExtension: class CExtension:
"""An abstraction of an extension implemented in C/C++ """An abstraction of an extension implemented in C/C++
@ -60,6 +64,7 @@ def checkextensions(unknown, ignored):
return ret return ret
def get_extension_defn(moduleName, mapFileName): def get_extension_defn(moduleName, mapFileName):
if win32api is None: return None
dsp = win32api.GetProfileVal(moduleName, "dsp", "", mapFileName) dsp = win32api.GetProfileVal(moduleName, "dsp", "", mapFileName)
if dsp=="": if dsp=="":
sys.stderr.write("No definition of module %s in map file '%s'\n" % (moduleName, mapFileName)) sys.stderr.write("No definition of module %s in map file '%s'\n" % (moduleName, mapFileName))