SOLVED ImportError: No module named AppKit



  • Hi! I'm trying to use Visual Studio Code to make some scripts, but when I try to pair it I get the following message:

    user@user-MacBook-Pro ~ % roboFont -h
    Traceback (most recent call last):
      File "/usr/local/bin/roboFont", line 3, in <module>
        from AppKit import NSWorkspace, NSWorkspaceLaunchWithoutActivation, NSRunningApplication, NSURL, NSDistributedNotificationCenter
    ImportError: No module named AppKit
    

    Does anyone know what's happening?

    Thanks!!


  • admin

    ah, I assume you have a custom python2 installed. Where AppKit is not installed.

    I would recommend (not only for RoboFont but as lots of macOS tools uses python) not to overwrite your system python.



  • @frederik Thank you!!! I had a 2.7 version which I installed for something, I just deleted it and now it works 😄



  • @eduairet said in ImportError: No module named AppKit:

    ImportError: No module named AppKit

    This post suggests that the error ImportError: No module named AppKit would come from overwriting one’s system python, but I am fairly certain I have avoided ever doing that on my current system. However, I do suspect that maybe changes to my PATH variable might affect this... How could I determine why /Applications/RoboFont.app/Contents/Resources/RoboFont.py is unable to import AppKit? Should I somehow adjust my PATH variable to correct this?



  • I resolved my AppKit problem by opening a new terminal window and installing PyObjC with pip install -U pyobjc


Log in to reply