Any Python programmers? help!

Lorenzo Taylor lorenzo at taylor.homelinux.net
Sat Jun 4 17:30:11 EDT 2005


I have a python script that is giving me serious grief.  It is too big to send
to the list, so I would like mail off list if anyone may be able to help.  The
necessary files are linked in this message.

The script is a BitTorrent downloader used as part of a podcast receiver.  It
should download a file from a torrent and exit on completion.  The podcast
program then takes the torrents and puts them into a list for seeding.  The
downloader script will work independently for testing purposes, but I am trying
to imbed it as a "here-document" in the podcast program itself.  It takes a
torrent as an argument.

My python script works fine if I call it directly, but I want to pipe it as
standard input to python.  If I do this, it does what it is supposed to do,
except at the end, it exits with an error code of 1, but there is no error
message or any other indication of what went wrong.  I have tried it both with
and without the line that says
#!/usr/bin/python
which of course is unnecessary if I am providing the script as stdin to python,
but I get the same result either way.  Note also that the script only exits
abnormally upon completion of a download.  If the file is already downloaded, it
exits with a code of 0.

I have also tried:

cat podtorrent.py | python - <torrent>

and

python - <torrent> < podtorrent.py

with no success.  I also tried embeding it into my podcast program, which is
when I first noticed something was wrong.

The script can be found at
ftp://taylor.homelinux.net/software/scripts/podtorrent.py
and a test torrent may be found at
ftp://taylor.homelinux.net/SDR2005-06-03.mp3.torrent

If anyone could help, email me off-list with suggestions, patches or whatever.

Thanks for any help,
Lorenzo
-- 
"We decided that we should evaluate the Microsoft offerings first. Once we
realised what a powerful set of tools they were, it became self-evident this was
the right way to go down."

Microsoft: the right way to go down




More information about the Speakup mailing list