Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with using the --sound argument on MacOS #75

Open
adamlass opened this issue Sep 8, 2021 · 2 comments
Open

Problem with using the --sound argument on MacOS #75

adamlass opened this issue Sep 8, 2021 · 2 comments

Comments

@adamlass
Copy link

adamlass commented Sep 8, 2021

Problem with using the --sound argument on MacOS:

%0A%0A%60%60%60%0ATraceback %28most recent call last%29%3A%0A File %22%2Fusr%2Flocal%2Fbin%2Fkattis%22%2C line 40%2C in main%0A execCommand%5Bcommand%5D%28data%29%0A File %22%2FUsers%2Fadamlass%2FDocuments%2Fcs1%2FKat%2Fcommands%2Fsubmit.py%22%2C line 79%2C in submitCommand%0A winsound%28%29%0A File %22%2FUsers%2Fadamlass%2FDocuments%2Fcs1%2FKat%2Fhelpers%2Fsound.py%22%2C line 8%2C in winsound%0A playsound%28random.choice%28glob.glob%28prefix %2B %22%2Fwin%2F%2A.mp3%22%29%29%29%0A File %22%2FLibrary%2FFrameworks%2FPython.framework%2FVersions%2F3.9%2Flib%2Fpython3.9%2Fsite-packages%2Fplaysound.py%22%2C line 55%2C in _playsoundOSX%0A from AppKit import NSSound%0AModuleNotFoundError%3A No module named %27AppKit%27%0A%0A%60%60%60

@adamlass
Copy link
Author

adamlass commented Sep 8, 2021

A more readable format:

Traceback (most recent call last):
   File "/usr/local/bin/kattis", line 40, in main
    execCommand[command](data)
   File "/Users/adamlass/Documents/cs1/Kat/commands/submit.py", line 79, in submitCommand
    winsound()
   File "/Users/adamlass/Documents/cs1/Kat/helpers/sound.py", line 8, in winsound
    playsound(random.choice(glob.glob(prefix + "/win/*.mp3")))
   File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/playsound.py", line 55, in _playsoundOSX
    from AppKit     import NSSound
 ModuleNotFoundError: No module named 'AppKit'

Error occurred:
 No module named 'AppKit'

@Duckapple
Copy link
Owner

Apparently the playsound package has an extra dependency on MacOS, details in this StackOverflow answer.

It seems like you have to install a bridge between Python and Objective C called PyObjC via pip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants