(VERY) New to Python. Need Help!

Don Bruder dakidd at sonic.net
Tue Aug 5 22:23:01 CEST 2003


In article <Vcecnfk4p6QPkq2iXTWJig at comcast.com>,
 "Terry Reedy" <tjreedy at udel.edu> wrote:

> "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
> (aside
> > from the obvious "fire up the program - if it pukes, the function
> isn't
> > there") if an arbitrarily selected function is available in a
> particular
> > 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

Actually, the FAQ that Richard pointed me at included a "cookbook" fix - 
specifically, ripping out the import of "getpid", and further along, 
teraing out the reference to it that happens while (if I've got *ANY* 
understanding at all of programming) building what appears to be a 
unique string. And as Richard said (and you imply), there is no such 
thing as "getpid" on pre-X Macs.

Thanks for the advice, though! God knows I need every bit of it I can 
get when I'm this "green" in a language!

-- 
Don Bruder -  dakidd at sonic.net <--- Preferred Email - unmunged, SpamAssassinated
Hate SPAM? See <http://www.spamassassin.org> for some seriously great info.
I will choose a path that's clear: I will choose Free Will! - N. Peart
Fly trap info pages: <http://www.sonic.net/~dakidd/Horses/FlyTrap/index.html>




More information about the Python-list mailing list