Help using telnetlib to install/remove rpms

Rebecca Hepper Rebecca.R.Hepper at
Thu Aug 2 21:02:07 CEST 2001

Hello All, 

I recently began looking at trying to use telnetlib to remove an old
rpm and install a new rpm.  I can manually telnet to the machine and
install/remove rpms but I can't get my python code to work.  The login
works OK but the erasing and installing of the rpms does not work.  I
have pasted my code below.  Can you see something that I have done

Also, do you have any ideas on how I can do an "rpm -q myrpm" and get
the exact version number so I know what to erase?

Thank you.

max_wait = 30
tn.read_until("login: ", max_wait)
tn.read_until("Password: ", max_wait)
# change to superuser, can't install rpm as normal user
tn.read_until("Password: ", max_wait)

tn.write("rpm -e myrpm-7.00-1\n")
tn.write("rpm -i myrpm-7.01-1.i386.rpm\n")

More information about the Python-list mailing list