QQuick / Opy

Obfuscator for Python
Other
362 stars 61 forks source link

No module named opy.__main__; 'opy' is a package and cannot be directly executed #33

Open RemiZOffAlex opened 5 years ago

RemiZOffAlex commented 5 years ago
$ python3.7 -m opy -h
Opy (TM) Configurable Multi Module Python Obfuscator Version 1.1.29
Copyright (C) Geatec Engineering. License: Apache 2.0 at  http://www.apache.org/licenses/LICENSE-2.0

/usr/bin/python3.7: No module named opy.__main__; 'opy' is a package and cannot be directly executed
BuvinJT commented 5 years ago

Sorry for the delay.

This fork was created first and foremost to make Opy into a library, rather than a standalone utility. Retro testing has not been performed regarding the way the you are attempting to this use it. Thank you for pointing out this bug! I will try to patch it in the immediate future.

In the meantime, please pull directly from my development fork at: https://github.com/BuvinJT/Opy. Also, please read those instructions regarding use of Opy as a library (which definitely functions!). Alternatively, you can also install it in the "release form" via pip opy-distbuilder.

chtseac commented 5 years ago

Hi, what is this a fork of? I would like to use it as a utility and I fail to find anything on Google or here. Importing opy and running opy.main() seems to bring back the original interface, but it seems to have been modified enough that it is not operational.

BuvinJT commented 5 years ago

Hi @chtseac. Opy-Distbuilder is a library rather than a standalone utility. (Well, it's supposed to support both methods of use, but I might have broken the old way - I have to test that again...) Anyway, you need to install it using pip then, from opy import obfuscate, OpyConfig. Call obfuscate, passing a few arguments including one of those OpyConfig objects. You could also import analyze, depending upon your use... As with any library, the public interface is defined in the init.py script: https://github.com/BuvinJT/Opy/blob/master/opy/__init__.py

Please read the README that is displayed on https://github.com/BuvinJT/Opy. The covers the installation process and basic use.

Btw, the settings object (how one provides all the configuration details) is defined in: https://github.com/BuvinJT/Opy/blob/master/opy/settings.py. It has a one-to-one with the external opy-config,txt

I would suggest, however, that instead of using this by itself, that you try "Distribution Builder" https://distribution-builder.readthedocs.io/en/latest/. It installs opy-distbuilder, and implements it for you, along with additions built over the top of it. "Distribution Builder" is a much larger, encompassing project for creating distributable programs and python libraries. It is in alpha still, and the documentation is in a rough draft state, but it's developed far enough to be usable at this point, and development is still quite active. It should really shape up in the coming months.