(VERY) New to Python. Need Help!

D

Don Bruder

Greetings, oh scaly ones... :)

I'm a Mac user with a fairly high level of computer literacy, including
reasonable programming skills in BASIC, C, Pascal, and several flavors
of ML, just trying to run a "canned" Python... Uhhh... Program? Script?
Module? - Yeesh... I'm such a rookie at Python I'm not even sure of the
right terminology to use here...

At this point in the game, I'm not actually trying to *DO* anything in
Python, I just want to run a program that's written in Python.
Specifically, I'm trying to run a P2P package called "BitTorrent".

So I've downloaded and installed a package calling itself "MacPython-OS9
2.2.3", which claims to be functional back to MacOS 8.1. (I'm running
8.6)

That was fairly painless. Now that I've got it installed, I'm slamming
face-first into a brick wall at high velocity - After diddling file
types per the docs for MacPython, I double-click the
"btdownloadheadless.py" file that the FAQ for BitTorrent says should run
for me, and I get a window opening up with this:

Python 2.2.3 (#139, Jun 1 2003, 23:11:08) [CW CARBON GUSI2 THREADS GC]
on mac
Type "copyright", "credits" or "license" for more information.

Traceback (most recent call last):
File "Megalon City
I:Downloads:BitTorrent-3.2.1b:btdownloadheadless.py", line 6, in ?
from BitTorrent.download import download
File "Megalon City
I:Downloads:BitTorrent-3.2.1b:BitTorrent:download.py", line 23, in ?
from os import getpid, path, makedirs
ImportError: cannot import name getpid

and nothing further happens.

Looks pretty obvious that something it wants can't be found. At this
point in my Python "career", I don't have a freakin' clue what, where to
tell it to look for it, or even *HOW* to tell it to look for it!

Anybody wanna to throw this newbie a bone?

Yes, I realize this is quite vague. Quite frankly, I don't know enough
about the language to even properly describe the problem.

So can Somebody please lend a hand here? Before you're forced to taunt
me a second time! :)

(Hey! Quit throwing those tomatoes! The docs said Monty Python
references are not only acceptable, but *ENCOURAGED*! :) )
 
T

Terry Reedy

Don Bruder said:
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

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
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top