pexpect/termios error: Inappropriate ioctl for device

L

Laszlo Nagy

Hi All,

I have a python program that downloads database backups from a remote server, and tries to replace the local database with the downloaded backup. The database is a PostgreSQL server and my program calls the pg_restore command with the aid of the wonderful pexpect module. Everything works fine if I start this program from a tty. When I try to start the same program from cron, I get this nasty exception:

Traceback (most recent call last):
File "/root/restore_databases.py", line 82, in ?
main()
File "/root/restore_databases.py", line 79, in main
restore_all()
File "/root/restore_databases.py", line 73, in restore_all
do_restore(os.path.join(BACKUPDIR,fname),database)
File "/root/restore_databases.py", line 56, in do_restore
dropdb(database)
File "/root/restore_databases.py", line 44, in dropdb
db.interact()
File "/usr/local/lib/python2.4/site-packages/pexpect.py", line 1226, in interact
mode = tty.tcgetattr(self.STDIN_FILENO)
termios.error: (25, 'Inappropriate ioctl for device')

What can I do to avoid this?

Thanks,

Laszlo
 

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,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top