Python Compilation to .exe - python-3.x

I am new to python and need to compile it into .exe version. My question is when a py script is compiled into .exe does it mean it cant decode anymore?
Our goal is make python scripts safe when deploying to client servers as we dont want them to get our source code using the .exe.

No - a compiled piece of code is compiled into another language (byte code) - you can not actually read the source code.
Do have a look at this though...

A savvy user who has this .exe version could extract the .pyc (byte code) and then break that down using a python decompiler like Uncompyle to get it pretty much back to source code. Thus there is a way (and a chance) of the python source code (close to it) getting extracting from your .exe version.

Related

How to detect if .exe file contains uncompiled code

Recently I discovered that .exe files sometimes still hold their source code (readable code).
I opened an exe in IDA and it told me it was written in .NET and I could see the source code opening the exe with a .NET decompiling program (DNspy).
Soon after I made an exe from a python script using pyinstaller. And similarly but with another program I was able to retrieve the original code from only the exe.
But opening the exe with IDA did not give me any indication that it was written in python/ build with pyinstaller. So I wonder if there is a program/tool/method that could detect how an exe was generated (maybe by looking at some magic bytes or something) ? Generally I would like to know for an exe if I can retrieve the source code.

I have tried many methods and I couldn't find solution. So how to convert Python file to executables?

Python : 3.5
PYinstaller : 3.5
Win64
cx_Freeze : 6.0
According to the above information, I have tried to convert Python project to exe but it does not work.
First I have tried pyinstaller but the process throw some error:
After that, I have tried cx_Freeze and it works, but the exe are working on some computer but not on every computer that have same platform.
I don't know what I can do. I looked for google and stackoverflow but there are unsolved problems or I couldn't see the solution.
Later I have tried to change python version but doesn't work again. Computers that have tried to running the exe, have same OS platform, I'm sure.
By the way, if you receive the following cx_Freeze error, resolving like this:
Build\exe.win-amd64-3.7\lib\scipy\spatial\cKDTree.cp37-win_amd64
change to
Build\exe.win-amd64-3.7\lib\scipy\spatial\ckdtree.cp37-win_amd64
Program uses the following modules : tkinter, pydicom, skimage, PIL, cv2, etc.
Primarily Program has 2 page that content code but I made single file for I came across this sentence "It's worth noting that pyinstaller can compile to a single .exe file"
What do you suggest I do? Thanks for your help.
Edit: I have been tried "Auto-py-to-exe" but I got an error (Fatal Error : Failed to execute script")
Edit2: I tried to run outside the anaconda. I think its work. But I'm still testing.
Edit3: I have tried to change python version, GUI was opened another computer but the program is not work properly. the program works on my computer but not on another computers
If you are not able to convert python file to executable format, you can try using auto py-to-exe library.
This library contains a GUI format to convert .py files to .exe
Here you can find auto py-to-exe with usage instructions,
https://pypi.org/project/auto-py-to-exe/

Read Linux or Windows MEX file on Mac OS [duplicate]

I've been given a Matlab program that uses an external C function. I only have the compiled version of this external function, and the extension is .mexglx . From what I have already red, it seems that this extension is the mex-file version compiled with linux. I run matlab under windows XP, and my problem is that my Matlab is not able to read the .mexglx extension. So my question is: is there any mean to change a file with the .mexglx extension to a .mex? Because for the moment I do not have the source code in C, so I can't recompile it correctly. I precise that my version of Matlab is R2007b if it can help.
Thank you for your answer
No there is no way, sorry. You need to get the source code to build it for a different platform.

Creating a Python Project using Atom

I m trying to create a python project in Atom IDE. I downloaded and installed Atom and also some package like project_manager.
I am finding it extremely hard to get going.
My project would have a few python files in the code folder. Some data files in the data folder, etc.
How do I start this in Python. I goggled this as well but still finding it difficult.
P.S. I know how to create python files and run them using IDLE. Want to do my work in a more structured manner by creating a project and then being able to compile and run my files fast and easily.
Regards
Bonson

How to compile Jython program so as to generate .class files?

I know that Jython before version 2.5 can achieve this by using the command "jythonc". But I am using Jython 2.5.3 now.
What I need is very simple: I want the Jython to compile my Python code and generate the .class files (or Java bytecode) for me, as I would need these .class files to do some analysis works. But unfortunately, the interpreter just directly runs the program without leaving any intermediate representations behind.
P.S.: I'm using a Mac

Resources