0

When I ran this script from idle it worked just fine

import keyboard
from playsound import playsound
import os

cwd = os.getcwd()

while True:     
    if keyboard.read_key() == "q":
        playsound(cwd + "\sound.wav")

But when I tried running it as a file it wouldn't work, it opens a window, I press "q" and it just closes

  • Python file is not an executable file. i.e not .exe (as in windows) that can be directly opened? you can run a program through an IDE or IDLE or from the command line only – arjunsiva Aug 31 '22 at 11:22
  • Does this answer your question? [How can I make a Python script standalone executable to run without ANY dependency?](https://stackoverflow.com/questions/5458048/how-can-i-make-a-python-script-standalone-executable-to-run-without-any-dependen) – Yevhen Kuzmovych Aug 31 '22 at 11:38

0 Answers0