Issue #95 resolved

AttributeError in some cases when checking sys.modules

Dan McCombs
created an issue

In some cases it's possible for pyobjc to trigger an Attribute error when loading modules:

  File "/Cocoa/__init__.py", line 9, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 1565, in _find_and_load
    return _find_and_load_unlocked(name, import_)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 1532, in _find_and_load_unlocked
    loader.load_module(name)
  File "/Foundation/__init__.py", line 9, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 1565, in _find_and_load
    return _find_and_load_unlocked(name, import_)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 1532, in _find_and_load_unlocked
    loader.load_module(name)
  File "/CoreFoundation/__init__.py", line 20, in <module>
  File "/objc/_lazyimport.py", line 82, in __init__
AttributeError: 'NoneType' object has no attribute 'startswith'

This is easily corrected by checking if nm is defined before calling .startswith. Patch attached.

Comments (2)

  1. Log in to comment