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


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to