[sage-support] Re: calling a C program in sage with terminal output

2008-10-17 Thread Marshall Hampton
os.popen is not really actively maintained, and I think has some minor defects that occaisonally come up, although for a simple program it probably doesn't matter. The best-supported and most robust way to do this without using something like Cython is the subprocess module (subprocess.Popen). T

[sage-support] Re: calling a C program in sage with terminal output

2008-10-17 Thread Martin Albrecht
On Friday 17 October 2008, mabshoff wrote: > On Oct 16, 4:51 pm, "David Joyner" <[EMAIL PROTECTED]> wrote: > > Hi: > > > > As pointed out popen is the easy way to go. Try sage; import commands sage: commands.getoutput("ls") 'algebras\nall_cmdline.py\nall_notebook.py\nall.py\nall.pyc\ncalculus\

[sage-support] Re: calling a C program in sage with terminal output

2008-10-17 Thread mabshoff
On Oct 16, 4:51 pm, "David Joyner" <[EMAIL PROTECTED]> wrote: > Hi: As pointed out popen is the easy way to go. > Also, what is the proper way to do this? I'm guessing one should > write wrapper classes as in the interfaces directory but is swig better? I would suggest Cython :) > - David J

[sage-support] Re: calling a C program in sage with terminal output

2008-10-16 Thread Jason Grout
David Philp wrote: > > On 17/10/2008, at 10:51 AM, David Joyner wrote: > >> Hi: >> >> I want to call a C program in Sage which is included with Sage >> (wtdist). >> What is the easiest way to do this? The line I'd like to execute >> looks like >> >> wtdist filename::code > output.txt > > ou

[sage-support] Re: calling a C program in sage with terminal output

2008-10-16 Thread David Philp
On 17/10/2008, at 10:51 AM, David Joyner wrote: > > Hi: > > I want to call a C program in Sage which is included with Sage > (wtdist). > What is the easiest way to do this? The line I'd like to execute > looks like > > wtdist filename::code > output.txt output_txt = os.popen('wtdist filenam