### this should show you why quoting is not easy import os try: from shlex import quote # python3.x except ImportError: from pipes import quote # python2.x msg=' ";xmessage This is a Shell Command" '; #os.system('espeak "' + msg + '"') # Bad idea :-( #os.system('espeak "' + quote(msg) + '"') # Bad idea too !!!! :-( os.system('espeak ' + quote(msg) ) # Better :-))