Question

I have a working python script that does not display any warning messages because I have included,

import warnings
warnings.filterwarnings('ignore')

The problem is that when I compile my code down into the exe using pyinstaller and run the exe I see the warnings. The warning message is simply telling me that a file was found but should not exist.

How can I have my exe hide the warning message?

Was it helpful?

Solution

It sounds like this is the warning you're trying to suppress. If it is, then the reason you can't suppress it is because it's being thrown by the PyInstaller bootloader before your script is even run (it's a reported bug). As described in the link, the duplicate causing the warning can be removed by adding the following code to your spec file after a = Analysis... :

for d in a.datas:
    if 'pyconfig' in d[0]: 
        a.datas.remove(d)
        break
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top