0

I'm writing a program with Python and now I'm writing the uninstall program. Not removing the uninstall program itself is uncomfortable to users. Is there a way to remove it without have the user to manually delete?

P.S. The exe is produced by PyInstaller. That doesn't really matter -- I'm writing an other exe to remove the original. Now the code is something like this:

import os
import shutil  
for i in ('xxx.exe', 'xxx.txt', 'xxx.db'):  
    try:  
        os.remove(i)  
    except (FileNotFoundError, OSError, IOError):  
        pass  
shutil.rmtree('xxx')
wyz23x2
  • 298
  • 4
  • 16
  • 3
    why not put your package on PyPi, then you can use `pip install` and `pip uninstall` – Chris_Rands Apr 21 '20 at 14:42
  • @Chris_Rands My exe is to be used by non-programmer people, like games and apps on computers and others, not a package for programmers to install and use – wyz23x2 Apr 21 '20 at 14:45
  • 1
    Are you using py2exe, PyInstaller, cx_Freeze or similar? your question is a bit unclear – Chris_Rands Apr 21 '20 at 14:47

0 Answers0