April 20th, 2013, 07:20 AM
Python 2.7.3 os.system("")
i wrote a small button window to try and automate somethings i do repetitively, all on the same server :
start a server wol <<<button 1
mount a share <<<<button 2
unmount a share <<<<button 3
start webmin in firefox <<<<button 4
ssh into a server <<<<button 5
i have the button set up activebackground='green' so when i press the mount share
button it turns green while python carries out my code. witch is fine with most things i'm doing but when my code starts an external program it hangs my code till i close the program i had python open
my question is is there a way to do this without hanging my program ?
def ab2 (self):
os.system("x-terminal-emulator -e /home/klein/places/acronq/scripts/2400_mnt.sh")
in python ide if i run os.system("keepnote") it starts the program and returns 0 then back to the prompt.
if i close the terminal it terminates keepnote if i close keep note it gives me the prompt back in terminal is there a solution ?
if i open keep note from a terminal it holds the terminal with this:
KeepNote 0.7.8: Sat Apr 20 08:15:19 2013
enabling extension 'notebook_http'
enabling extension 'backup_tar'
enabling extension 'new_file'
enabling extension 'editor_insert_date'
enabling extension 'command_basics'
enabling extension 'export_html'
enabling extension 'python_prompt'
enabling extension 'keepnote'
April 20th, 2013, 08:07 AM
Of many solutions, the easiest is to stick an ampersand at the end of the command. See this reference.
os.system("x-terminal-emulator -e /home/klein/places/acronq/scripts/2400_mnt.sh &")
os.system("nohup keepnote >&/dev/null &")
os.system("( keepnote & ) &")
The other solutions I referred to would be python solutions.
or, in Windows
[/code] are essential for python code and Makefiles!
April 20th, 2013, 09:31 AM
it worked like a charm !!!!!!
thank you i have another question but i will start another thread