2

I wrote a program that takes a screenshot and sends it to my e-mail address. I made my python scripts executable using pyinstaller. I did it by executing command: pyinstaller -w screenshot.py -F

  • The executable program ran perfectly on my PC but when I ran it to my friend's PC, I got error saying "This app can't run on your PC. To find a version for PC, check with the software publisher."

How can I solve this problem?

1 Answer 1

4

This error is not an error specific to Python. This is a warning the Windows 10 operating system gives the user when they attempt to run usually two kinds of programs:

  1. A program deemed malicious by Windows

  2. A program built on 64-bit system that is trying to run on a 32-bit system.

My guess is most likely option #2. There is nothing wrong with your code. But from what you described, this sounds like a problem with your usage of Pyinstaller. The way Pyinstaller builds programs is clever, but it depends on the system you built it on. For example, if you built the program on Windows 7, you will likely have problems running it on Windows 10.

See: https://pyinstaller.readthedocs.io/en/stable/usage.html

So when distributing your program in this case, you are running into issues because you failed to target something about your friend's set up. Like if you used a 64-bit version of Python to freeze your script, and your friend is trying to run it on a 32-bit system. More details are needed to properly help you--like the version of Windows you built it on versus that of your friend.

Sign up to request clarification or add additional context in comments.

6 Comments

Oh My God . You are amazing. I didn't see that going. I tried the same executable file on my friend's 64 bit computer, it worked perfectly. Thank you very much. Now, I have another issue. How can I make it executable in both 32 as well as in 64 bit OS ?
I would build it on 32-bit Windows 10. 64-bit computers can run 32-bit and 64-bit. But, if you build on 64-bit, as seen in your problem, it will not run on 32-bit systems. You could actually just install 32-bit Python on your 64-bit machine and then use Pyinstaller.
I have another question too. I have made the setup file for the above program. It is working perfectly but I want it to be copied to the startup folder just like other program do. How can I do it ?
You are too kind. I am happy to help anytime. However, can you rephrase your last question? What do you mean by 'startup folder'? Do you mean making your program more like other traditional programs with its own icon and 'Start' menu shortcut? Pyinstaller has options to make your program a single-file executable which you can customize with your own icon. Sorry if I misunderstood. Please clarify and provide more details.
No, I didn't mean that. What I mean is I have made setup for the above program. When I installed it, it installed correctly. But I want my program automatically to be started when the system boots just like u torrent, Internet Downloader Manager, etc. does. Lastly, I want to add some code in my program that makes my program start in startup
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.