[Tutor] accessing files, (EXE files) Making EXE files from Python
Alan Gauld
alan.gauld at btinternet.com
Sat Sep 27 23:50:06 CEST 2008
"Johnny" <jgowen at lorettotel.net> wrote
> I was wanting (as a project for learning) to be able to make
> a menu program for executing various programs on my hard drive.
OK, As a first project thats good. I'd start with a text based menu
then rtry to convert it to a GUI later maybe.
> Can you call on EXE files from python?
Yes, there are several ways of doing this but the current "official"
way of doing it is via the subprocess module. There are several
examples in the module documentation.
Also if you are on Windows you may find the os.startfile command
useful to execute whatever is the default program for a given file.
Notepad for .txt files for example. Its like double clicking in
Windows
Explorer.
> also, one last question,,,
> How can you turn your newly made python program into a
> exe program to pass out to friends?
Yes, or you can build an installer that installs Python on your
friends
PC too. (A bit like installing the Java JVM to run Java programs)
But while its not very hard, its not trivial either so I'd concentrate
on
learning Python first. If your friends want a copy get them to install
Python first (they might even want to learn too when they can see
what you can do! :-) Once you've gotten the hang of Python you can
take a look at Py2exe and other similar programs.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list