By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,035 Members | 1,324 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,035 IT Pros & Developers. It's quick & easy.

pexpect/termios error: Inappropriate ioctl for device

P: n/a
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
May 31 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.