OT: Python Import question
John Arbash Meinel
john at arbash-meinel.com
Mon Sep 3 17:24:13 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Jeremy Wilkins wrote:
> I've been trying to tell one python script to import another, the
> problem is the other script is in a different non-child folder.
> Neither are in the default import path. I can't set PYTHONPATH before
> hand and when i set it inside a script it seems to have no effect, eg
> import os
> os.environ['PYTHONPATH'] = '/folder/containing/secondscript'
> import script2
> I'm stumped so any help much appreciated
By the time you are inside python you want to set sys.path
Just depending on whether you want python to search there first for
things (override if it is located elsewhere) or last (if it hasn't found
it, use it from there).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the bazaar