LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
LinkBack Search this Thread
Old 02-17-2005, 03:31 PM   #1
datadriven
Member
 
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.

Code:
def set_remote_keys(Window):
	global REMOTE_MACHINE
	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/id_rsa.pub " + 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;\"")
	curses.wrapper(Main)
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.
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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


All times are GMT -5. The time now is 07:24 AM.

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