LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-29-2009, 08:50 PM   #16
gabrielalcivar
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Rep: Reputation: 0

Guys,
I have a similar problem, I need to run 1 command (varies constantly) with xterm in python:

xterm -e "command" &

It will run a program in the shell, but the problem is that as soon as the program is done, it closes the window automatically (and the output can't be seen). The program will also ask some input from the user (therefore read only doesn't work!). Please can you help me? It doesn't have to be xterm, it can also be gnome-terminal.
Googling got me here, sorry if its not the right place, but I've spend 1 hour looking for an answer and nothing even comes close to it!
Thank you!
 
Old 04-30-2009, 01:18 AM   #17
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Hello Gabriel :-)

Did you try the techniques explained by Gazl in http://www.linuxquestions.org/questi...29#post3456129 (bash rc file) and
http://www.linuxquestions.org/questi...65#post3456765 (multiple commands on the -e option)? Your python code could write the rc file with the variable command or set up the -e option command, giving you the variable one command you need.

Alternatively you could use a gnome-terminal profile with "When command exits" set to "Hold terminal open" and invoke the custom profile with gnome-terminal's --window-with-profile option.

Best

Charles
 
Old 04-30-2009, 05:36 AM   #18
gabrielalcivar
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Rep: Reputation: 0
<deleted>

Last edited by gabrielalcivar; 04-30-2009 at 05:53 AM.
 
Old 04-30-2009, 05:41 AM   #19
gabrielalcivar
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Rep: Reputation: 0
I cant' try the gnome-terminal solution, because there's a bug in Ubuntu Jaunty 9.04, which doesnt let you run gnome-terminal as sudo. But thats what I had in mind...I'm waiting for the bug to be solved.

The other way seems not efficient enough to me. There most be an easier way to do it with xterm. GazL's solution can be run in python? Thanks!
 
Old 04-30-2009, 06:28 AM   #20
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Hello Gabriel :-)

Quote:
Originally Posted by gabrielalcivar View Post
I cant' try the gnome-terminal solution, because there's a bug in Ubuntu Jaunty 9.04, which doesnt let you run gnome-terminal as sudo. But thats what I had in mind...I'm waiting for the bug to be solved.
Then why did you write "It doesn't have to be xterm, it can also be gnome-terminal"

Quote:
Originally Posted by gabrielalcivar View Post
The other way seems not efficient enough to me.
Which other way is not efficient enough? There are _two_ other ways apart from the gnome-terminal profile way: "bash rc" and "multiple commands". What's the efficiency issue?
Quote:
Originally Posted by gabrielalcivar View Post
There most be an easier way to do it with xterm.
Why must there be an easier way to do it with xterm?

AFAIK xterm isn't significantly different from gnome-terminal as regards your problem and the known solutions; "bash rc" and "multiple commands" use bash features, not gnome-terminal features. Maybe you would like to use xterm's Xterm.hold property to hold the window open after running the command. It's similar to the gnome-terminal profile solution you can't run in ubuntu 9.04.
Quote:
Originally Posted by gabrielalcivar View Post
GazL's solution can be run in python? Thanks!
I don't python but, assuming it can write files and issue commands (!), then yes it can be used to implement Gazl's "bash rc" and "multiple commands" solutions.

Best

Charles
 
Old 04-30-2009, 06:41 AM   #21
gabrielalcivar
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Rep: Reputation: 0
Charles,

Quote:
Then why did you write "It doesn't have to be xterm, it can also be gnome-terminal"
The gnome-terminal/GConf issue, hopefully would be solved eventually, and gnome-terminal is my terminal of choice.

Quote:
Which other way is not efficient enough? There are _two_ other ways apart from the gnome-terminal profile way: "bash rc" and "multiple commands". What's the efficiency issue?
I guess you're right, I decided to go for the "sleep" solution Gazl posted.

Quote:
Why must there be an easier way to do it with xterm?
For simplicity's sake, it seems such an easy option to put in any terminal program(--noclose or something), but I get life is not simple.

Quote:
I don't python but, assuming it can write files and issue commands (!), then yes it can be used to implement Gazl's "bash rc" and "multiple commands" solutions.
I just switched (2 weeks ago) to learning Python and for that matter linux itself. I just would need some help adapting the "bash" solution to a python script.

Thank you!
 
Old 04-30-2009, 07:20 AM   #22
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Hello Gabriel :-)

Quote:
Originally Posted by gabrielalcivar View Post
I just switched (2 weeks ago) to learning Python and for that matter linux itself. I just would need some help adapting the "bash" solution to a python script.
Oh! That's quite a learning curve you've taken on! Welcome to the Linux world.

Do you mean you are running a python program and want to start xterm (eventually gnome-terminal) and run a bash script in it or run a python script in it?

Best

Charles
 
Old 05-01-2009, 08:24 PM   #23
gabrielalcivar
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Rep: Reputation: 0
The sleep method works just fine. How would it be possible with gnome-terminal to have a similar solution?

Quote:
Oh! That's quite a learning curve you've taken on! Welcome to the Linux world.
Thank you -- especially that this is a more of a "hobby" to me

And thanks again to all for the help, i don't know what i would do without these forums!
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
xterm -display remote:0.0 Can't open display - xterm from tru64 to debian 3.1 loopy69 Linux - Software 2 04-01-2008 07:54 PM
LXer: On keeping an open mind LXer Syndicated Linux News 1 03-03-2007 10:20 PM
keeping the terminal window open NNP Linux - General 1 09-02-2005 12:08 AM
keeping xterm awake LancerNZ Linux - Newbie 1 05-06-2005 08:41 PM
Keeping windows open martinpanda Programming 0 01-25-2002 04:46 PM


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

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration