Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91126

Re: PYTHONPATH when calling from ipython

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'skip:\\ 30': 0.09; 'python': 0.11; 'interpreter': 0.15; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:when': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'windows': 0.20; "skip:' 40": 0.22; 'bit': 0.23; '2015': 0.23; 'module': 0.23; 'import': 0.24; 'header :User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'found.': 0.27; 'command': 0.28; 'cest': 0.29; 'work.': 0.30; 'this?': 0.34; 'could': 0.35; 'to:addr:python-list': 0.35; 'set.': 0.35; 'something': 0.35; 'skip:o 20': 0.35; 'but': 0.36; 'there': 0.36; 'modules': 0.36; 'subject:: ': 0.37; 'instead': 0.38; 'received:org': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'mark': 0.40; 'received:de': 0.40; '>>>>>': 0.66; 'saturday': 0.66; 'cecil': 0.84; 'schreef': 0.84; 'westerhof': 0.84; '\xe2\x80\xa6': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: PYTHONPATH when calling from ipython
Date Sat, 23 May 2015 15:25:04 +0200
Organization None
References <874mn5qjc8.fsf@Equus.decebal.nl> <mailman.268.1432372378.17265.python-list@python.org> <87iobjpnt4.fsf@Equus.decebal.nl>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Gmane-NNTP-Posting-Host p57bd8bd4.dip0.t-ipconnect.de
User-Agent KNode/4.13.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.275.1432387517.17265.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1432387517 news.xs4all.nl 2900 [2001:888:2000:d::a6]:41831
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 3816
X-Received-Body-CRC 1000326507
Xref csiph.com comp.lang.python:91126

Show key headers only | View raw


Cecil Westerhof wrote:

> Op Saturday 23 May 2015 11:12 CEST schreef Mark Lawrence:
> 
>> On 22/05/2015 06:20, Cecil Westerhof wrote:
>>> I am looking into using ipython instead of bash. But when I call a
>>> python program from ipython PYTHONPATH is not set. So pythonscripts
>>> that need a module through PYTHONPATH will not work.
>>>
>>> I could do something like:
>>> !PYTHONPATH=~/Python/PythonLibrary python2 …
>>>
>>> But I find that a little bit cumbersome. Is there a better way to
>>> do it?
>>>
>>
>> What makes you think this?  Have you tried:-
>>
>>>>> import os
>>>>> os.environ['PYTHONPATH']
>> 'C:\\Users\\Mark\\Documents\\Cash\\Python;C:
\\Users\\Mark\\Documents\\MyPython'
>>
>> That might be from the command line interpreter but it also works
>> the same from iPython for me on Windows 8.1.
> 
> That does not change anything. The modules are not found. Also not
> when using %run.
 

That may be because ~ is not expanded.

Try

os.environ["PYTHONPATH"] = os.path.expanduser("~/Python/PythonLibary")

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

PYTHONPATH when calling from ipython Cecil Westerhof <Cecil@decebal.nl> - 2015-05-22 07:20 +0200
  Re: PYTHONPATH when calling from ipython Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-23 10:12 +0100
    Re: PYTHONPATH when calling from ipython Cecil Westerhof <Cecil@decebal.nl> - 2015-05-23 12:53 +0200
      Re: PYTHONPATH when calling from ipython Peter Otten <__peter__@web.de> - 2015-05-23 15:25 +0200
        Re: PYTHONPATH when calling from ipython Cecil Westerhof <Cecil@decebal.nl> - 2015-05-23 16:08 +0200
          Re: PYTHONPATH when calling from ipython Laura Creighton <lac@openend.se> - 2015-05-23 17:00 +0200
            Re: PYTHONPATH when calling from ipython Cecil Westerhof <Cecil@decebal.nl> - 2015-05-23 17:24 +0200
          Re: PYTHONPATH when calling from ipython Peter Otten <__peter__@web.de> - 2015-05-23 18:09 +0200
            Re: PYTHONPATH when calling from ipython Cecil Westerhof <Cecil@decebal.nl> - 2015-05-23 19:30 +0200
              Re: PYTHONPATH when calling from ipython Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-23 19:13 +0100
                Re: PYTHONPATH when calling from ipython Cecil Westerhof <Cecil@decebal.nl> - 2015-05-23 21:47 +0200
              Re: PYTHONPATH when calling from ipython Cecil Westerhof <Cecil@decebal.nl> - 2015-05-23 20:14 +0200

csiph-web