This question already has answers here:
How to obfuscate Python code effectively? [duplicate]
(22 answers)
Closed 2 years ago.
I have been distributing my python scripts as Pyinstaller compiled executeables so that people can't steal my code, but I found that there are many tools like this which can easily decompile executeables generated by Pyinstaller. Is there any way to obfuscate this code. I have seen other people asking similar questions, but people just reply convert the code to c or c++ and compile it. This seems like it would work, but I have no idea where to start.
You can check out this How to obfuscate Python code effectively? for details on how to do a simple obfuscation, but the reality is that obfuscation is basically always reversible. Depending on why you are obfuscating your code there may be better ways to go about this.
If it's just to keep people from stealing your source, most people won't even go as far as the decompilation, but the SO answer above should help. Full on obfuscation even in C or C++ has issues, and usually a system exists to decompile all popular obfuscation systems.
Related
This question already has answers here:
How can I run a Python project on another computer without installing anything on it?
(6 answers)
Closed 9 months ago.
Problem:
I need to send someone (who has little to no computer knowledge) a python program, but I don't even know if he has python installed let alone all the dependencies.
Question:
Assuming he doesn't have python, how should I go about sending the application so that It is as straightforward as possible for him?
What I've tried:
Initially, I thought of using venv and sending him the whole thing, but there has got to be a better solution, as my code only uses two of the built-in libraries.
In my research, I came across Docker, but I think he would need to have that installed. I also saw pipenv but it wouldn't work without python on his PC.
You have multiple ways to do so:
Create an executable file, which is quite a long process but can be useful is you project contains a lot of files and multiple dependencies
Send them the python code (I recommend it if your project fits in one .py file). The person will need to install python and possibly a few pip libraires, but it's not extremely complicated in my opinion, with clear instructions.
Finally, you can go on repl.it and create a repl, which is simply a way to execute code on your browser. I think this is the best option for both large and small projects, except if it contains a lot of odd dependencies, and I'm not sure if repl.it supports graphical interfaces either. Anyway, you should take a look, it might be perfectly fit your needs
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Anyone has any python simulator to recommend? am new to python programming. is there any program similar to codeblocks for C++ programming? Thanks
I think you might be slightly confused over terminology.
The term "simulator" doesn't really mean much in the context of programming. A simulator is something which pretends to be some other platform so you can test code on it. For example, I might use an Android simulator or a Gameboy simulator on my computer so I can test code without having to transfer it all the time.
You might mean "IDE" instead. Codeblocks is an example of an IDE. It stands for "Integrated Development System". It combines a "compiler" (something which turns what you write into executable code) and a specialized "text editor" (a program which lets you write text). It also includes a wide variety of convenient features to make programming in C++ more easy.
Note that you technically don't need an IDE to write code. An IDE combines a compiler (or an interpreter, in the case of Python) with a text editor, and a bunch of extra features for convenience, but this is by no means "necessary", strictly speaking. All you need in order to write code is a text editor of some sort, and a compiler or interpreter.
For example, I typically use either Notepad++ or Vim to write my Python code, and run it directly from the command line.
Regardless, Python has a wide variety of IDEs you can look at. Here is a comparison of the most popular ones.
However, you don't necessarily need a fancy IDE to program in Python! If you just directly install Python, it comes with a simple IDE called "IDLE" which you can use to write and run Python code. If you're new to Python, I recommend you use IDLE for now, until you get the hang of things.
tl;dr
To summarize:
A simulator is a program that pretends to be some other kind of computer/platform. Simulators are used to test code.
An IDE stands for "Integrated Development System" and is used to write and run code.
It combines a compiler or interpreter with a text editor.
There are many IDES for Python. Here is a list.
However, I recommend you use IDLE, which is included by default when you install Python.
Codeblocks does have a plugin for Python: http://wiki.codeblocks.org/index.php?title=Python_plugin . Though, I am not sure, how popular that is!
There was a similar discussion on SO: What IDE to use for Python?
This question already has answers here:
Undecompilable Python
(2 answers)
Closed 9 years ago.
Can I block others from seeing my code? I'm working on something in Python. As I save it, it's a (.py) and everyone can right-click and see the code. This is unlike C where I generate an .exe that you can't simply (!) read.
You can read the assembly code generated by the process of the compilation in C. The code is not hidden : it's a bit more complex to read, because it is ASM. But it is totally and definitively not hidden :)
Python is made by Open Source community, so the idea is not about hiding your code. If ever you want to make a .exe from a Python code, you can have a try to Py2Exe or Freeze :
http://www.py2exe.org/
http://wiki.python.org/moin/Freeze
Cheers,
K.
This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
What IDE to use for Python?
Hi recently started looking at Python, basically for scripting, so far I've been doing exercises from the web, which is OK. I'm using gEdit and its fine. but I'm curious to know what is a good IDE for python, that will still allow me to discover. One of the things I'm used to in Visual Studio is code completion,code snippets and tips, so when you type FOO then CTRL+SPACE you get to see what methods,properties etc are available for FOO. You can select a method press F1 and get HELP on its usage. Really helps discovery and learning. Can anyone recommend a good IDE preferably FREE that works well on windows(Linux is optional) and has features such as code completion,code snippets,code tips
You might want to try Vim or Eclipse.
This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
Calling Python from Objective-C
I'm a long-time Python programmer and short-time Cocoa programmer. I'm just getting started with PyObjC and it's really amazing how easy it it is to get stuff done. That said, I wanted to try using pure ObjC for my controller with PyObjC models. I might be enjoy letting Python be Python and Objective-C be Objective-C. I figured it was worth a try, anyways.
Except I can't figure out or find anything about how to call Python from Objective-C, only the other way around. Can someone point me to any resources on this? (Maybe it's on the PyObjC site but I just don't know what I'm looking for?)
Edit: I'm most interested, at the basic level, in being able to call a Python module and get some native ObjC data types back.
There are several possible approaches. The most tempting is to use py2app to compile a loadable bundle from your python code from which you can access the principal class using NSBundle. Unfortunately, this use case hasn't gotten much love from the py2app developers, and I've found several bugs in 10.5 and 10.6, including a rather nasty memory leak when passing data from python back in to Objective-C. I wouldn't recommend using py2app at thist point.
The second approach is invert the embedding. Write a Python cocoa app and load your Objective-C code from a bundle at startup (even in main()). If you already have a large Objective-C app, this may take a bit of work. The only downside, that I'm ware of, is that you won't be able to use GC in your Objective-C code, but this is really a universal limitation in working with PyObjC.
Finally, you can instantiate a python interpreter in your Objective-C code to load your python code. This is obviously more involved, but may the best option if you already have a large Objective-C codebase into which you want to inject your python code. The main.m file from the Python-Cococa application template in Xcode is a good place to start to see this in action.
Whoops, guess I should've searched a bit more:
Calling Python from Objective-C