I have created a simple program for Windows in Python (converted to .exe with Pyinstaller) that copy itself to a created folder in Program Files. The program works perfect except one unforeseen detail, when the file copy itself to the directory it replaces the .exe extension with .py which makes the file unfunctional. Why is this happening?
Here is a very simple example that illustrate the problem:
import os
import shutil
filePath = os.path.abspath(__file__)
folder = 'some folder in C'
shutil.copy(filePath, folder)
Convert it to .exe in Pyinstaller with the following:
Pyinstaller --onefile name-of-file.py
When you run the program it will create a .py copy...