Skip to content
Advertisement

How can I make Windows beep when pyinstaller is finished running?

Good morning!

I’m currently trying to work on making an executable for my Python script using PyInstaller and so I often have to wait for it to finish compiling (is that the right word in this case?), but I don’t want to keep staring at the screen unnecessarily.

I understand that I can import winsound and make it beep that way from within a script, but how would I do so with pyinstaller from terminal?

In other words, whenever I type in “pyinstaller myScript.py” into terminal and Python finishes creating the executable, I’d like Windows to beep.

Advertisement

Answer

You can simply run it sequentially after the pyinstaller program: pyinstaller myScript.py; python3 -c "print('7')";

You can also try pyinstaller myScript.py; echo ^G;. Where ^G is the character that is printed when you do Ctrl + G on your keyboard.

Using winsound, you could have a simple python script that beeps:

beep.py

import winsound 
              
winsound.Beep(500, 250) # Hz, ms

then in your terminal: pyinstaller myScript.py; python3 beep.py`

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement