System default sys.path

Brock Pytlik bpytlik at sun.com
Thu Jul 2 16:31:35 EDT 2009


David Lyon wrote:
> On Wed, 01 Jul 2009 19:48:04 -0700, Brock Pytlik <bpytlik at Sun.COM> wrote:
>   
>> Hi, I'm trying to find a way to get the value sys.path would have on a 
>> particular system if python was started with an empty python path. I do 
>> want it to include the site specific additional paths. I know I can hack 
>> this information myself, 
>>     
>
> Copy the code out from site.py...
>
>   
Well, as far as I can tell, site does several things. It calls 
abs__file__ which, afaict, doesn't effect sys.path. Then it calls 
removeduppaths, which walks over sys.path. That means that sys.path has 
already been set by something at that point. So, how/where did sys.path 
get set then? Or is sys.path always empty there at startup and this code 
is just to handle other situations?

[snip]

Brock



More information about the Python-list mailing list