3

I have converted a python project into an exe file using pyinstaller. The basic functionality in the python project is to read files, parse the file contents, and write them into an excel document. The exe file works perfectly fine in my system as I have generated, but when I distribute this exe file to other systems, McAfee antivirus deletes the exe file by displaying the message as "Access denied".

How to handle this situation? I have tried both the commands for pyinstaller and also the auto-py-to-exe tool. But nothing works.

I have also informed the IT team, but they say, there is a potential threat in the exe file.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Sambit
  • 7,625
  • 7
  • 34
  • 65

2 Answers2

5

In issues on GitHub mentioning 'virus' in the PyInstaller repo htgoebel repeatedly states:

Please contact you anti-virus vendor. There is nothing we can do about this false positive.

If your anti-virus vendor considers one of the files included in the PyInstaller distribution or a file generated by PyInstaller to be malicious, there is nothing we can do about this. Even if we'd change our code, they'd change their pattern and the race starts again.

See this mailing-list thread and other tickets for his topic.

So when asking "How to handle this situation?", there isn't much you can do. Like htgoebel said, you can't control what anti-virus vendors match and changing what/how PyInstaller outputs will just be matched to be flagged again later.

You possibly could change to a different anti-virus vendor but that may be out of your control and you'll still have the issue when the package is distributed.

Community
  • 1
  • 1
Brent Vollebregt
  • 149
  • 2
  • 10
1

PyInstaller does seem to be the most popular choice for converting a python script into an exe, but there are other choices:

How do I convert a Python program to a runnable .exe Windows program?

When I wasn't able to get around this problem in PyInstaller, I looked for a different tool. I chose cx-freeze over py2exe simply because it had more recent commits on github. It worked great:

python -m pip install cx_Freeze
python -m cx_Freeze test.py
cd build\exe.win-amd64-3.10
test.exe

Output:

Hello world

In case the PyInstaller devs care, my anti virus is CrowdStrike Falcon.

Samuel
  • 8,063
  • 8
  • 45
  • 41