(VERY) New to Python. Need Help!

Terry Reedy tjreedy at udel.edu
Tue Aug 5 22:12:01 CEST 2003

"Don Bruder" <dakidd at sonic.net> wrote in message
news:beLXa.8574$dk4.365557 at typhoon.sonic.net...
> Any indication of whether there's a "getpid" function in the Carbon
> version of MacPython? And how would I go about checking to see
> from the obvious "fire up the program - if it pukes, the function
> there") if an arbitrarily selected function is available in a
> Python implementation?

In the installation directory is a subdirectly Lib (at least for *nix,
windows versions, don't know if mac is same).  In that directory is a
file called os.py which, when imported, becomes the os module.  In
that file are a number of definitions.  Your BT program, by including

>>>    from os import getpid, path, makedirs

is looking for those three particular names.  So you could look thru
the file to see if they are there.  Running  the program seems easier
;-), although looking will verify that os.py, path, and makedirs *are*
present (and getpid present or not).

If so, you could verify the that absence of getpid is exactly the
problem by deleting it from import list and adding as the next line
print 'got here'; raise SystemExit

Terry J. Reedy

More information about the Python-list mailing list