[Tutor] Import modeuls

Oleg Oltar oltarasenko at gmail.com
Mon Jul 21 11:15:53 CEST 2008


They want me to do one test runner which runs any test... And ideally it
should work on any platform....

When I added something to $PYTHONPATH, they told me to remove it...



On Mon, Jul 21, 2008 at 12:11 PM, arsyed <arsyed at gmail.com> wrote:

> On Mon, Jul 21, 2008 at 4:46 AM, Oleg Oltar <oltarasenko at gmail.com> wrote:
>
>> Anyway. another related question. I run tests using the runner.py
>>
>> It has following syntax
>> sys.path.insert(path)
>> os.popen("python module to run")
>>
>> Will the python runned from the file see new path?
>>
>>
>>
> I'm not sure but I don't think so. Try and see what happens.
>
> I think to get that behavior, you want to set the PYTHONPATH environment
> variable instead. Then, I believe the child process will inherit the parent
> process's environment variable. If that doesn't work, look into the
> subprocess module which takes an explicit env parameter for the Popen class
> in order to accomplish this.
>
> It's probably easier just to set PYTHONPATH in your shell and then run your
> scripts so all programs will have access to it.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080721/33af5f11/attachment.htm>


More information about the Tutor mailing list