Search code examples
pythonexeconvertersantivirusvirus

Created an EXE file from .py and it's detected as virus


I was able to convert a .py file to and exe file, however when I try to send it via Gmail, it detects as a virus. Also, when trying to transfer the file on a USB flash drive, the computer says it's a virus. Any ideas on how to fix this?


Solution

  • Apart from getting your exe signed (not really a viable option unless you're working on a big and important project) or writing the program in a natively compiled programming language like C, no, there is no way to avoid the detection since the Py2Exe converter you're using embeds the Python interpreter and all needed dependencies into the binary, which is a technique often used by viruses.

    EDIT FOR:

    I didn't actually get the fact that Gmail is the thing blocking the exe, not your AV. Well, as said by other comments, Gmail blocks certain files by default. Try adding the exe to a zip or rar archive and send that instead of the plain .exe.