Why is there no way to pass PYTHONPATH on the command line?

On 19 September 2012 17:36, Gerald Britton <gerald.britton at gmail.com <http://mail.python.org/mailman/listinfo/python-ideas>> wrote:
Sure, but that's easy to remedy. just add & set *PYTHONPATH=* to the end. If you want to get fancy, save the current value in a temporary variable and use it later to reset the value. We're really dealing with a limitation of the Windows Shell. Things are somewhat better in PowerShell but it's still not like BASH. Probably better to write a little script that saves the variable PYTHONPATH, sets it as desired, calls Python, then resets it afterwards. -- Gerald Britton

BTW, this works: PS C:\Python26> powershell {Set-Item -Path env:PYTHONPATH -value C:\temp; c:\python26\python} Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
PS C:\Python26> ls env:PYTHONPATH Get-ChildItem : Cannot find path 'PYTHONPATH' because it does not exist. At line:1 char:3 + ls <<<< env:PYTHONPATH + CategoryInfo : ObjectNotFound: (PYTHONPATH:String) [Get-ChildItem], ItemNotFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand PS C:\Python26> On Wed, Sep 19, 2012 at 3:02 PM, Gerald Britton <gerald.britton@gmail.com>wrote:
-- Gerald Britton

BTW, this works: PS C:\Python26> powershell {Set-Item -Path env:PYTHONPATH -value C:\temp; c:\python26\python} Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
PS C:\Python26> ls env:PYTHONPATH Get-ChildItem : Cannot find path 'PYTHONPATH' because it does not exist. At line:1 char:3 + ls <<<< env:PYTHONPATH + CategoryInfo : ObjectNotFound: (PYTHONPATH:String) [Get-ChildItem], ItemNotFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand PS C:\Python26> On Wed, Sep 19, 2012 at 3:02 PM, Gerald Britton <gerald.britton@gmail.com>wrote:
-- Gerald Britton
participants (1)
-
Gerald Britton