Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep open a cmd window

I have a python code in a program that opens a cmd window and runs there another program. The code looks like:

os.chdir('C:/Abaqus_JOBS' + JobDir)
os.system('abaqus job=' + JobName + '-3_run_rel2 user=FalseworkNmm41s interactive')

Now everything works but I get an error in the cmd window and next it closes very quickly not letting me see what was the error. How can I prevent this cmd window to close?

like image 641
jpcgandre Avatar asked May 15 '13 17:05

jpcgandre


1 Answers

Add + " & timeout 15" or + " & pause" to the string you pass to os.system:

os.chdir('C:/Abaqus_JOBS' + JobDir)
os.system('abaqus job=' + JobName + '-3_run_rel2 user=FalseworkNmm41s interactive' + " & timeout 15")

consider using popen (Difference between subprocess.Popen and os.system) instead.

like image 88
0x90 Avatar answered Oct 13 '22 23:10

0x90