[Tutor] What's wrong with this?
andreas at kostyrka.org
Sat May 5 02:06:55 CEST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Andre Roberge wrote:
> Perhaps the following might be helpful:
> (if the link does not work, google for "launching python program
> cross-platform" or go to
> On 5/3/07, Jason Coggins <jcoggins828 at charter.net> wrote:
>> I have the following function in a program:
>> What I want to do is launch the program in the os.popen() function. The
>> file I am trying to launch is located in the same directory as the program
>> the function is contained in. I also use Linux if that makes a difference.
Well, first the current directory might not be the same as the directory
where the script is stored.
So you need something like this:
import os, sys
fp = op.popen(os.path.join(os.path.dirname(sys.argv), "filename.py", "r")
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the Tutor