Batteries Included?

A

Alex

One of the first things I wanted to do when I start learning Python was
to produce a simple standalone application that I could distribute to
my users (windows users). Python's moto is "Batteries Included", but
where are the batteries for making exe files and making an installer
file? I had to download, install and use py2exe and Inno Setup in order
to accomplish this. I might be wrong expecting that a language whose
moto is "Batteries Included" would be able to produce exe files. Are
there plans to do this in the future version of Python?

Alex
 
S

Sybren Stuvel

Alex enlightened us with:
Python's moto is "Batteries Included", but where are the batteries
for making exe files and making an installer file?

Those aren't "batteries". Those are things you can do with the
program, but are outside the programming language. Writing and
distributing software is one thing. Converting them to a
platform-specific executable is another.
I had to download, install and use py2exe and Inno Setup in order to
accomplish this.

Well done.
I might be wrong expecting that a language whose moto is "Batteries
Included" would be able to produce exe files.

Indeed, you're wrong. Why would such an ability be included in Python?
It's a cross platform language. What need would Mac, Linux, BSD,
Solaris etc. users have for such a feature? And why would it have to
be included, when there is an easy solution just around the corner?
You prooved that it was easy enough to install and use by someone who
just learned Python. I really don't see the problem here.
Are there plans to do this in the future version of Python?

I doubt it.

Sybren
 
M

Mike Meyer

Alex said:
One of the first things I wanted to do when I start learning Python was
to produce a simple standalone application that I could distribute to
my users (windows users). Python's moto is "Batteries Included", but
where are the batteries for making exe files and making an installer
file? I had to download, install and use py2exe and Inno Setup in order
to accomplish this. I might be wrong expecting that a language whose
moto is "Batteries Included" would be able to produce exe files. Are
there plans to do this in the future version of Python?

Did you try looking through the distutils docs? After you create a
setup.py file for you program, doing

"python setup.py bdist --formats=wininst"

should do the trick.

Of course, I don't own a Windows box, so I can't check it, but when I
ask a setup file for help on formats, it tells me the wininst format
is a windows installer.

Personally, I think of building a platform-specific bundle for
distribution to end users as more along the lines of shipping than
batteries. Python comes with lots of tools to help you get your
application working - the batteries. Once it's working, you don't need
batteries: you need wrapping paper, and a box, and tape, and so on.

<mike
 
P

Paul Rubin

Sybren Stuvel said:
Indeed, you're wrong. Why would such an ability be included in Python?

distutils.exe, included in Python, in fact does have the ability to
produce .exe files, just not completely general ones.
It's a cross platform language. What need would Mac, Linux, BSD,
Solaris etc. users have for such a feature?

The same need that they have for msvcrt, winreg, winsound, or the SGI
IRIX specific functions currently in the library. The same need that
Windows users have for the Unix specific parts which are in the
library. The same need that non-numeric programmers have for the
cmath module, which is also in the library.
And why would it have to be included, when there is an easy solution
just around the corner? You prooved that it was easy enough to
install and use by someone who just learned Python. I really don't
see the problem here.

Um, if the TV ad for some Walkman says "batteries included" and the
batteries aren't included, you have legitimate reason to ask what's
going on. That it's easy enough for you to go to the store and buy
batteries separately is irrelevant. You didn't get what was
advertised.

Now a Windows .exe installer wasn't one of the advertised features of
Python and maybe there's good reasons to leave it out, but its
platform specificness is not one of those reasons. There's already
plenty of platform specific stuff in Python.

Personally I think including a .exe packager in Python would be a
great idea. As a Linux user I can't easily run Windows-specific
utilities like Inno Setup. So I don't have a good way to make .exe's
from my Python code that Windows users can easily run. Having a cross
platform .exe packager included with Python would be useful the same
way cross compilers are useful. I'm using an x86 computer but I can
easily configure gcc to produce ARM code. Why shouldn't my Linux
Python installation be able to produce Windows .exe's?
 
M

Michele Simionato

Mike Meyer:
After you create a setup.py file for you program, doing

"python setup.py bdist --formats=wininst"

should do the trick.

Of course, I don't own a Windows box, so I can't check it, but when I
ask a setup file for help on formats, it tells me the wininst format
is a windows installer.

I can confirm that it works (for pure Python applications), since I did
it.

Michele Simionato
 
M

Marco Aschwanden

I might be wrong expecting that a language whose
moto is "Batteries Included" would be able to produce exe files. Are
there plans to do this in the future version of Python?

Yes, you are wrong expecting that. Creating an exe-cutable is windows
specific and python _tries_ to be platform neutral. py2exe - a wonderful
tool which I use myself - is a battery on the shelves. It can be easily
picked from there.

Furthermore it is not Python's philosophy to create "exe-cutables". But I
do understand your wish (being a Windows Developper at work myself) and
Python is not a matter of course within Windows.

Your best bet is ActiveState which bundles a windows specific version. Ask
them, maybe they are willing to include it. Python should refrain from
doing so.

Before overloading the "included batteries" an approach as found in Perl
(CPAN) should be adapted... eg.
http://peak.telecommunity.com/DevCenter/EasyInstall

Have a nice day,
Marco
 
G

Guest

Personally I think including a .exe packager in Python would be a
great idea. As a Linux user I can't easily run Windows-specific
utilities like Inno Setup. So I don't have a good way to make .exe's
from my Python code that Windows users can easily run. Having a cross
platform .exe packager included with Python would be useful the same
way cross compilers are useful. I'm using an x86 computer but I can
easily configure gcc to produce ARM code. Why shouldn't my Linux
Python installation be able to produce Windows .exe's?

Because you can't run it yourself? If you cannot run the freshly-made exe
yourself, why would you want to distrubute it, without even trying? But if
you can, then you can run the InnoSetup as well.

But, for me, I don't care whether such an option will be included or not. I
won't object anyway.
 
P

Paul Rubin

Because you can't run it yourself? If you cannot run the
freshly-made exe yourself, why would you want to distrubute it,
without even trying? But if you can, then you can run the InnoSetup
as well.

Obviously I'd want someone to test the .exe before putting it in wide
distribution. That doesn't solve the problem of how to make the .exe.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top