That is because $PYTHONPATH is just a string variable.  It will
replace $PYTHONPATH with the actual string of your current path to
pass into sudo which is then passed into the echo command.  So echo is
just reporting the string you passed in.

To really test it, setup a script to run with sudo:

#!/bin/bash

echo $PYTHONPATH;


-John

On Mon, Jun 7, 2010 at 9:27 AM, Matthew Gardner <[email protected]> wrote:
> On Mon, Jun 7, 2010 at 9:05 AM, Garrett Hyde <[email protected]> wrote:
>>
>> What do you get when you execute
>>
>> sudo echo $PYTHONPATH?
>
> This was weird to me, because sudo echo $PYTHONPATH gives the right path,
> but when I do sudo python, and then import sys, print sys.path, it gives me
> the wrong path.  I'm not sure what OS X is doing behind the scenes.
> --------------------
> BYU Unix Users Group
> http://uug.byu.edu/
>
> The opinions expressed in this message are the responsibility of their
> author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG.
> ___________________________________________________________________
> List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list
>
--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list

Reply via email to