Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-17-2005, 04:31 PM   #1
Registered: Jun 2003
Location: Holly Hill, Florida
Distribution: Slackware 10.1
Posts: 317

Rep: Reputation: 30
python - make curses play nice w/ os.system()

Hey guys. I've been looking all over to the answer to this but most search engines just turn up a lot of links to the same 2 or 3 tutorials. I'm writing a backup program in python, and decided to put a curses interface on it, but don't know how to run system commands without ending the curses window. e.g.

def set_remote_keys(Window):
	curses.endwin() # if anybody know a way around this please let me know
	os.system("ssh-keygen -t rsa")
	os.system("ssh " + REMOTE_MACHINE + " \"mkdir .ssh;exit;\"")
	os.system("scp ~/.ssh/ " + REMOTE_MACHINE + ":.ssh/extra_keys2")
	os.system("ssh " + REMOTE_MACHINE + " \"cat .ssh/extra_keys2 >> .ssh/authorized_keys2;rm .ssh/extra_keys2;exit;\"")
	os.system("ssh " + REMOTE_MACHINE + " \"chmod 700 .ssh;exit;\"")
In the example, the system commands set up ssh keys on the remote machine. They require that the user hit enter 3 or 4 times. How can I output the text and get the necessary input without ending the curses window. I tried using addstr() & getstr() but I end up with either an error message or the program just hanging. I'm still kind of new to python, and I'm hoping that there's just something simple that I'm missing.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Messed up Python Curses happygiraffe98 Programming 2 12-02-2005 09:53 AM
i want to make a html page that looks like or is a curses gui. user1442 General 9 11-14-2005 06:51 PM
Ubuntu and Xorg don't play nice adamb10 Ubuntu 9 07-07-2005 12:25 AM
Anyone getting Suse 9.0 and Vmware to play nice? Caeda Linux - Software 1 12-10-2003 08:35 PM
httpd and dhcp won't play nice Citizen Bleys Linux - Software 2 11-17-2003 07:44 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:58 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration