Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python code present in app made by py2app

I am making an app in python on mac osx 10.8.5 I converted the python script into an app by using py2app. But, within app, On Show Package Contents-->Contents-->Resources original code is present. I don't want to show my code to others by distributing my app as security issue. I removed the (.py)code with (.pyc)code, in that case the app didn't work properly. Please suggest some way for it.I search on other questions also, but didn't get the desired result. My setup.py is

from setuptools import setup

APP=['myapp.py']
DATA_FILES= [('',['config.cfg'])]
OPTIONS={'iconfile':'cc.icns','argv_emulation': True,'plist':{'CFBundleShortVersionString':'1.0'}}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app']
    ) 
like image 236
imp Avatar asked Nov 11 '22 19:11

imp


1 Answers

The easiest workaround is to move the code in myapp.py to another module and import that module in myapp.py.

Note that modules other than the main script are only byte-compiled (as .pyc files), and those files can still easily be turned into source code.

Byte-compiling the script file is on my todo list, but is more complicated that just replacing a .py file by a .pyc file as you noticted :-)

like image 149
Ronald Oussoren Avatar answered Nov 15 '22 01:11

Ronald Oussoren