mrstephengross wrote: > I would like to distribute a python program, but only in .pyc form (so > that people cannot simply look at my code). Is there a way to do this? > I've read up a little on the logic by which python creates .pyc's, and > it sounds like python requires the main executed program to be in .py > format. Any ideas?
Make a dummy script to import your main module. The resulting pyc can be fed directly to the Python interpreter. <----------------------------------------------------------------------> # main.py : My main source code. I cleverly will distribute only the # byte code, such that no one knows my secrets. D'oh! You caught me # monologging again... if __name__ == "__main__": print "Ha! Now you can't see me." <----------------------------------------------------------------------> # dummy.py : Imports the main module to create main.pyc. import main <----------------------------------------------------------------------> [some client's prompt]% python main.py Ha! Now you can't see me. -- http://mail.python.org/mailman/listinfo/python-list