Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#!/usr/bin/python3
import socket
import win32com.client as wincl
client = socket.socket() # Connect to IP:Port
port = 12346
client.connect(('localhost', port))
try:
while True:
msg = input('>') # User inputs a message
client.send( msg.encode('utf-8') ) # Encode the messsage in bits and send it to server
rawmsg = client.recv(1024) # recieve up to 1024 bytes
msg = rawmsg.decode('utf-8').rstrip('\r\n') # Decode received message from bits to string
print(msg) # convert and clean the input
speak = wincl.Dispatch("SAPI.SpVoice")
msg = msg.replace('m/s','meters per second') # So speach reads m/s correctly
speak.Speak(msg)
except KeyboardInterrupt:
print('Shutdown')
client.shutdown(1)
client.close()