2

Is there a way how to be sure, my source code is really hidden? I use pyinstaller to create exe, in order to my friends can use my app without python. My idea was to create a USB disk with all files from pyinstaller, they are locked to prevent the reading the code. This app could be started only by a shortcut on desktop. But i did not find a way how to solve it. Do somebody know a functional way to lock my python app without opportunity of reading the code in order to use it only?

3
  • 4
    You can use pyinstaller with --onefile option. So, you will have only exe file without any additional ones. Commented Nov 14, 2018 at 14:20
  • 2
    You could look into pyarmor. It obfuscates your code for you. It will make it another step harder. Creating a file with pyinstaller already makes it tough to reverse engineer it. Commented Nov 14, 2018 at 14:22
  • Thank you Bogdan. I hope the --onefile is very safely. Commented Nov 16, 2018 at 7:21

1 Answer 1

2

You could compile your code into "pyc" format with py_compile

import py_compile
py_compile.compile(filename, compiled_filename, optimize=2)

Note this :
You need the same version of python and all library that you use to launch this compiled file.
For load file (e.g. : open("text.txt", "r")), you need to specify all the tree (e.g. : open("C:/Users/Me/Desktop/MyProgram/test.txt", "r"))

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

Comments

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.