Launch file from Python
fw3 at hotmail.co.jp
Wed Oct 10 22:38:30 CEST 2007
I have tried to use os.system to run an application inside python on ms-window. However, the applicaion will grap the python and I could not do anything inside python shell unless I quit the application. Are there any way to avoid this? so I can still type command in python shell. Here is the command I used to open the editor:
After this command if I do not quit the gvim, I could not enter command in python shell.
> From: grahn+nntp at snipabacken.dyndns.org> Subject: Re: Launch file from Python> Date: Sun, 12 Aug 2007 17:44:48 +0000> To: python-list at python.org> > On Wed, 08 Aug 2007 10:28:57 -0700, jocago at gmail.com <jocago at gmail.com> wrote:> > Good afternoon from someone who is trying to learn Python.> >> > I would like to launch an app from within a Python script. From the> > examples I have found, I should be able to do this with os.system.> >> > I use this:> > os.system("xplanet-1.2.0/xplanet.exe -fontsize 24 -label -target earth> > -lat 33.65 -lon -84.42 -radius 40 -num_times 1 -tmpdir .")> > This is copied directly from the .bat file that launches the xplanet> > app. It works there.> >> > and get this:> > 1> > That means "error", as others noted.> > It is odd that you get no printouts. Had this been on Unix, you'd> either get "file not found" or similar from the shell trying to run> the thing, or something from xplanet itself (only really badly> programs return failure without printing some kind of cause).> > Two more comments, assuming you are on Windows (you mention ".bat> files"):> > - You use the relative path xplanet-1.2.0/xplanet.exe. That should> require your program to have the parent of xplanet-1.2.0 as current> directory. Did the .bat script change directory first?> > - It is unusual to use / as a path separator on Windows --> xplanet-1.2.0\xplanet.exe is more normal. Some parts of Windows> tolerate both, others do not, IIRC. But Python itself should not> care in this case.> > /Jorgen> > -- > // Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu> \X/ snipabacken.dyndns.org> R'lyeh wgah'nagl fhtagn!> -- > http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list