0

For some quick context, I was trying to make a game where you essentially would press a key and control how a symbol moves around a 2d array, however when trying to use the keyboardmodule in python, I get this error,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Quartz/__init__.py", line 6, in <module> import AppKit File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/AppKit/__init__.py", line 10, in <module> import Foundation ModuleNotFoundError: No module named 'Foundation'

import random
import keyboard

board = [ 
    ["*","*","*","*","*","*","*","*","*"], 
    ["*","*","*","*","*","*","*","*","*"], 
    ["*","*","*","*","*","*","*","*","*"], 
    ["*","*","*","*","*","*","*","*","*"], 
    ["*","*","*","*","*","*","*","*","*"], 
    ["*","*","*","*","*","*","*","*","*"], 
    ["*","*","*","*","*","*","*","*","*"], 
    ["*","*","*","*","*","*","*","*","*"], 
    ["*","*","*","*","*","*","*","*","-"], 
    
]


def move_handle(): 
    while True:  
        try:  
            if keyboard.is_pressed(37): 
                print('You Pressed A Key!')
            elif keyboard.is_pressed(38): 
                print("you pressed a key") 
            elif keyboard.is_pressed(39): 
                print("you pressed a key ")
            elif keyboard.is_pressed(40): 
                print("you pressed a key")
        except:
            pass 

move_handle(board)
Ryan
  • 19
  • 3
  • [Here](https://stackoverflow.com/questions/1614648/importerror-no-module-named-foundation) is similar question. Maybe will help you. – user2976612 May 16 '22 at 13:29

1 Answers1

0

1.Are you sure if you have the module installed? If not, do pip install foundation

2.Check if your venv has the module installed, if not install it in the venv.

Lad Life
  • 1
  • 1
  • 1
    Foundation is already installed, I just double checked and it says that it's satisfied when I try to install it. How exactly would I check if the venv has the module installed? – Ryan May 16 '22 at 13:54