[python-uk] Python, VB math simple problem

Andy Robinson andy at reportlab.com
Sat Apr 1 10:10:38 CEST 2006


> Ideally, I'd love to be able to simply have some extremely small 
> executable that just accepts inputs
> does the calculations above and then spits out the outputs. If it were 
> possible to write some
> simple lines of math code in Python and then compile these scripts in 
> Python to a Windows
> compatible executable,that would be fantastic.

You can use py2exe (www.py2exe.org) to create an executable, but it 
won't be tiny.  If you slim down the imported modules to what you need 
which is minimal, I'd be surprised if it ended up less than 2Mb.
It is, however, effortless.


You might find it easier to expose your function as a COM server, which 
is also very easy in Python and py2exe will again let you make a slimmed 
down distribution.  This way there will be no startup overhead of 
shelling out every time. At the risk of being cheeky, let me say that 
the book Mark Hammond and I wrote in 2000, Python Programming on Win32, 
  was aimed exactly at people with a VB background and covers the 
integration possibilities you'll need in a lot of detail.  The same info 
is available more briefly in tutorials in the Pythonwin online help.
The main thing which changes since then is having py2exe and Python zip 
archives to make it all easier to deploy.

Good luck,


Andy Robinson



More information about the python-uk mailing list