Orange Forum • View topic - Orange and py2exe?

Orange and py2exe?

A place to ask questions about methods in Orange and how they are used and other general support.

Orange and py2exe?

Postby Olexij » Sun May 01, 2005 11:01

Hello,
is it possilble to package python application developed with orange to single executable via py2exe? Is it already done by someone?

Postby jurem » Wed May 04, 2005 15:08

Hi,
yes it should work without any problems if your (python) dependencies are OK.
You have to write your own setup.py script and import py2exe module in it. When the script is ready you should call from command line:
Code: Select all
python setup.py py2exe

It will generate directory dist/ where it will be .exe file you want (and other related stuff).
Really quick example (not related directly to orange) would be:

< filename 'hello.py' >
Code: Select all
import sys   # <-- py2exe knows it should put those modules with distribution of your
                    #       .exe file
print "Hello world!"
print "System information: "+sys.version

< end of hello.py>

< filename 'setup.py' >
Code: Select all
import distutils,py2exe

setup(console=["hello.py"]) # <-- .exe will call hello.py file

< end of setup.py>

After 'python setup.py py2exe' you should have in dist/ directory hello.exe, which will output string from the script.
The same goes with orange, for example you could call orngCanvas.py script (in orange/OrangeCanvas directory) to run Orange Canvas from .exe file.

It was not tested very much yet, but in future we might put extra example for py2exe on orange web page.

Regards, Jure


Return to Questions & Support



cron