On Monday, July 27, 2015 at 1:24:50 PM UTC-4, neubyr wrote:
> I am trying to understand sys.path working and best practices for managing it 
> within a program or script. Is it fine to modify sys.path using 
> sys.path.insert(0, EXT_MODULES_DIR)? One stackoverflow answer - 
> http://stackoverflow.com/a/10097543 - suggests that it may break external 
> 3'rd party code as by convention first item of sys.path list, path[0], is the 
> directory containing the script that was used to invoke the Python 
> interpreter. So what are best practices to prepend sys.path in the program 
> itself? Any further elaboration would be helpful. 

The best practice is not to modify sys.path at all, and instead to install
modules you need to import.  That way they can be imported without resorting
to sys.path fiddling in the first place.

Is there a reason you can't install the modules? Maybe we can help solve that.

--Ned.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to