[IPython-user] Re: os.startfile -> infinite loop

Tom Popovich tpop.news at gmail.com
Mon Sep 5 15:20:35 CDT 2005


If you look at subprocess it has 2 easy to use static methods.

call should do background semantics by default.

also when porting "startfile" remember you have to tell it what program to 
use to handle the call, when using call() , e.g., on windows by default 
*.txt is "associated" with notepad.exe, so doing os.startfile on a .txt will 
run notepad. w. os.startfile you did not have to specify notepad.exe, w/ the 
new approach you would.

On 9/5/05, Tom Popovich <tpop.news at gmail.com> wrote:
> 
> I use subprocess w/ 2.3 (and installed it from the web site mentioned 
> above)
> it works nicely.
> 
> just do:
> 
> import subprocess
> subprocess.call( [ 'program', 'arg1' , ...] )
> 
> rather than os.startfile (which is win32 only) 
> 
> On 9/1/05, Robert Kern <rkern at ucsd.edu> wrote:
> > 
> > Fernando Perez wrote:
> > > Oops, I forgot to finish that: the above is because subprocess 
> > appeared
> > > in python 2.4, while ipython supports 2.2 and 2.3 users.
> > 
> > FYI, subprocess.py can be dropped in as-is for 2.3 at least. It might
> > also be compatible 2.2, but I've never checked.
> > 
> > I think Tom's suggestion to use subprocess might be for Ryan to replace
> > os.startfile() in the script rather than you to replace %run.
> > 
> > --
> > Robert Kern
> > rkern at ucsd.edu
> > 
> > "In the fields of hell where the grass grows high
> > Are the graves of dreams allowed to die."
> > -- Richard Harter
> > 
> > _______________________________________________ 
> > IPython-user mailing list
> > IPython-user at scipy.net
> > http://scipy.net/mailman/listinfo/ipython-user
> > 
> 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/ipython-user/attachments/20050905/8235528a/attachment.html 


More information about the IPython-user mailing list