1326 except ImportError: |
1326 except ImportError: |
1327 f = None |
1327 f = None |
1328 if f is None: |
1328 if f is None: |
1329 fullpath = list(path) + sys.path |
1329 fullpath = list(path) + sys.path |
1330 f, file, (suff, mode, type) = find_module(module, fullpath, _extensions) |
1330 f, file, (suff, mode, type) = find_module(module, fullpath, _extensions) |
|
1331 if f: |
|
1332 f.close() |
1331 if type not in SUPPORTED_TYPES: |
1333 if type not in SUPPORTED_TYPES: |
1332 # not supported source, can't do anything with this module |
1334 # not supported source, can't do anything with this module |
1333 if f: |
|
1334 f.close() |
|
1335 _modules[modname] = Module(modname, None, None) |
1335 _modules[modname] = Module(modname, None, None) |
1336 return _modules[modname] |
1336 return _modules[modname] |
1337 |
1337 |
1338 mod = Module(modname, file, type) |
1338 mod = Module(modname, file, type) |
1339 try: |
1339 try: |
1340 src = f.read() |
1340 src = Utilities.readEncodedFile(file)[0] |
1341 mod.scan(src) |
1341 mod.scan(src) |
1342 finally: |
1342 except (UnicodeError, IOError): |
1343 f.close() |
1343 pass |
1344 if caching: |
1344 if caching: |
1345 _modules[modname] = mod |
1345 _modules[modname] = mod |
1346 return mod |
1346 return mod |
1347 |
1347 |
1348 def _indent(ws): |
1348 def _indent(ws): |
1387 raise ImportError |
1387 raise ImportError |
1388 |
1388 |
1389 # standard Python module file |
1389 # standard Python module file |
1390 if name.lower().endswith('.py'): |
1390 if name.lower().endswith('.py'): |
1391 name = name[:-3] |
1391 name = name[:-3] |
1392 ## if isinstance(name, type("")): |
|
1393 ## name = name.encode('utf-8') |
|
1394 |
1392 |
1395 return imp.find_module(name, path) |
1393 return imp.find_module(name, path) |
1396 |
1394 |
1397 def resetParsedModules(): |
1395 def resetParsedModules(): |
1398 """ |
1396 """ |