Stupid Python Questions
Gerhard Häring
gerhard.haering at opus-gmbh.net
Thu Mar 13 09:58:24 EST 2003
JohnFrog <j0hnfr0g at yahoo.com> wrote:
> I have never used Python, and I am wondering about this following
> things (OS=Win2K):
>
> 1) Can I call and run DOS executables from a Python script?
Windows 2000 has a MS-DOS emulation environment, so you should be able to
run MS-DOS programs under Windows 2000 ;-) Many people mistake Windows
console applications with MS-DOS applications ...
Python can make the OS run other executables just fine. Here's a simple
example:
import os
os.system("cmd.exe")
This will run the Windows shell.
> 2) Can I easily create a standalone program (1 file) that runs under
> DOS (command prompt) that contains my script and the Python
> interpreter (or just what is needed for my script), so that from an
> end-user perspective it just looks like a DOS executable?
Yes, that's possible with either py2exe or Gordon McMillan's installer.
Normally you'll get a .exe and several .dll and .pyd files from these
tools. Gordon's installer has an option to pack everything into a single
.exe, but this is a hack that I'd personally avoid.
URLs:
http://py2exe.sf.net/
http://starship.python.net/crew/gmcm/distribute.html
> 3) Is there a preferred place to download a Python interpreter from?
http://python.org/ in particular http://python.org/2.2.2/
an alternative distribution is available from
http://www.activestate.com/
Either one is fine.
-- Gerhard
More information about the Python-list
mailing list