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


Groups > comp.lang.python > #91134

Re: PYTHONPATH when calling from ipython

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!newsfeed.pionier.net.pl!feed.xsnews.nl!border03.ams.xsnews.nl!feeder04.ams.xsnews.nl!feeder02.ams.xsnews.nl!abp002.ams.xsnews.nl!frontend-F09-09.ams.news.kpn.nl
From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.python
Subject Re: PYTHONPATH when calling from ipython
Organization Decebal Computing
References <874mn5qjc8.fsf@Equus.decebal.nl> <mailman.268.1432372378.17265.python-list@python.org> <87iobjpnt4.fsf@Equus.decebal.nl> <mailman.275.1432387517.17265.python-list@python.org>
X-Face "(y8cC@tg_12{">GF'UXTW]FHI2wMiZNrnf'1EFQ&O#$m:f#O7+7}kR<J%a^F2lh4[N~Yz4 nSp#c+aQo1b5=?HcNEkQ7QzF<])O3X4MDL/AYjys&*mt>,v+Pti8=Vi/Z"g^?b"E
X-Homepage http://www.decebal.nl/
Date Sat, 23 May 2015 16:08:00 +0200
Message-ID <87egm7petb.fsf@Equus.decebal.nl> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:nMvQa3Auw16qMHJ1khacd+Lag3I=
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
Lines 51
NNTP-Posting-Host 81.207.62.244
X-Trace 1432391364 news.kpn.nl 20132 81.207.62.244@kpn/81.207.62.244:39823
Xref csiph.com comp.lang.python:91134

Show key headers only | View raw


Op Saturday 23 May 2015 15:25 CEST schreef Peter Otten:

> 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")

That is not the problem:
    os.environ['PYTHONPATH']
gives:
    .:/home/cecil/Python'

As I interpret it is that the very handy shell variable is not used in ipython.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

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