Thanks to visit codestin.com
Credit goes to github.com

Skip to content

inas404/Beep-on-error

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Beep-on-error

This is a simple python template I made to beep on exception and print it out. I needed it mostly when i run a code that might take so long running in the background and it suddenly stops on error and i don't notice till the end. This is justo to alert me.

All you need to do is to install sox:

pip install sox

Import these packages:

import os
import traceback
import logging

Then put your code in a try-except block:

try:

"""

writ your code here.

"""
except Exception as e:
	logging.error(traceback.format_exc())
	os.system('play --no-show-progress --null --channels 1 synth %s sine %f' % (1, 1000)) 
	# 1 is duration per second and 1000 is frequency per hertz

Finally run the python code and it will beep if any type of error occurs.

About

This is the python template i made to beep on error and print out the exception.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages