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


Groups > comp.lang.python > #100981

Re: Path problems when I am in bash

X-Received by 10.98.69.78 with SMTP id s75mr53588344pfa.5.1451474258034; Wed, 30 Dec 2015 03:17:38 -0800 (PST)
X-Received by 10.50.134.69 with SMTP id pi5mr1000886igb.5.1451474258002; Wed, 30 Dec 2015 03:17:38 -0800 (PST)
Path csiph.com!feeder.erje.net!2.us.feeder.erje.net!weretis.net!feeder6.news.weretis.net!news.glorb.com!mv3no23116638igc.0!news-out.google.com!f6ni38041igq.0!nntp.google.com!mv3no23116629igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Wed, 30 Dec 2015 03:17:37 -0800 (PST)
In-Reply-To <mailman.65.1451442628.11925.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=81.193.0.62; posting-account=IKHdJQoAAABz_0Q3gk1ShAWN2geJ79T8
NNTP-Posting-Host 81.193.0.62
References <09513926-226a-4099-a9d4-775ba4b09beb@googlegroups.com> <mailman.65.1451442628.11925.python-list@python.org>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <ca287ff7-fa27-447f-a124-5f84de331020@googlegroups.com> (permalink)
Subject Re: Path problems when I am in bash
From xeon Mailinglist <xeonmailinglist@gmail.com>
Injection-Date Wed, 30 Dec 2015 11:17:38 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.lang.python:100981

Show key headers only | View raw


On Wednesday, December 30, 2015 at 2:30:40 AM UTC, Karim wrote:
> On 30/12/2015 00:21, xeon Mailinglist wrote:
> > I have my source code inside the directory `medusa`, and my unit tests inside `tests` dir. Both dirs are inside `medusa-2.0` dir. Here is my file structure [1].
> >
> > When I run my tests inside pycharm, everything works fine, but when I try to run my unit tests inside in the prompt [2], the `scheduler/predictionranking.py` can't find the `hdfs` import [3]. I have set my environment inside the `medusa-2.0` dir with the virtualenv, I even have set `medusa-2.0` in the PYTHON_PATH [4]. The error that I have is in [5].
> >
> > The question is, why the import is not being done correctly?
> >
> >
> > [1] My file structure
> >
> > medusa-2.0$
> > medusa (source code)
> >     hdfs.py
> >     scheduler (dir with my schedulers)
> >         predictionranking.py
> > tests (my unit tests)
> >
> >
> > [2] I run the unit test like this.
> >
> > medusa-2.0$ python -v tests/testSimpleRun.py
> >
> >
> > [3] The header in `predictionranking.py`
> >
> > import hdfs
> >
> > def get_prediction_metrics(clusters, pinput):
> >      """
> >      :param pinput (list) list of input paths
> >
> >      """
> >
> >      input_size = hdfs.get_total_size(pinput)
> >
> > [4] My python path
> >
> >      export MEDUSA_HOME=$HOME/repositories/git/medusa-2.0
> >
> >      export PYTHONPATH=${PYTHONPATH}:${MEDUSA_HOME}/medusa
> >
> > [5] error that I have
> >
> > medusa-2.0$ python -v tests/testSimpleRun.py
> > # /home/xeon/repositories/git/medusa-2.0/medusa/local.pyc matches /home/xeon/repositories/git/medusa-2.0/medusa/local.py
> > import medusa.local # precompiled from /home/xeon/repositories/git/medusa-2.0/medusa/local.pyc
> > # /home/xeon/repositories/git/medusa-2.0/medusa/ranking.pyc matches /home/xeon/repositories/git/medusa-2.0/medusa/ranking.py
> > import medusa.ranking # precompiled from /home/xeon/repositories/git/medusa-2.0/medusa/ranking.pyc
> > # /home/xeon/repositories/git/medusa-2.0/medusa/decors.pyc matches /home/xeon/repositories/git/medusa-2.0/medusa/decors.py
> > import medusa.decors # precompiled from /home/xeon/repositories/git/medusa-2.0/medusa/decors.pyc
> > # /home/xeon/repositories/git/medusa-2.0/medusa/settings.pyc matches /home/xeon/repositories/git/medusa-2.0/medusa/settings.py
> > import medusa.settings # precompiled from /home/xeon/repositories/git/medusa-2.0/medusa/settings.pyc
> > import medusa.scheduler # directory /home/xeon/repositories/git/medusa-2.0/medusa/scheduler
> > # /home/xeon/repositories/git/medusa-2.0/medusa/scheduler/__init__.pyc matches /home/xeon/repositories/git/medusa-2.0/medusa/scheduler/__init__.py
> > import medusa.scheduler # precompiled from /home/xeon/repositories/git/medusa-2.0/medusa/scheduler/__init__.pyc
> > # /home/xeon/repositories/git/medusa-2.0/medusa/scheduler/predictionranking.pyc matches /home/xeon/repositories/git/medusa-2.0/medusa/scheduler/predictionranking.py
> > import medusa.scheduler.predictionranking # precompiled from /home/xeon/repositories/git/medusa-2.0/medusa/scheduler/predictionranking.pyc
> > Traceback (most recent call last):
> >    File "tests/simpleRun.py", line 4, in <module>
> >      from medusa.simplealgorithm import run_simple_execution
> >    File "/home/xeon/repositories/git/medusa-2.0/medusa/simplealgorithm.py", line 8, in <module>
> >      import accidentalfaults
> >    File "/home/xeon/repositories/git/medusa-2.0/medusa/accidentalfaults.py", line 5, in <module>
> >      import hdfs
> >    File "/home/xeon/repositories/git/medusa-2.0/medusa/hdfs.py", line 6, in <module>
> >      from system import execute_command
> >    File "/home/xeon/repositories/git/medusa-2.0/medusa/system.py", line 10, in <module>
> >      from ranking import rank_clusters
> >    File "/home/xeon/repositories/git/medusa-2.0/medusa/ranking.py", line 9, in <module>
> >      from scheduler.predictionranking import get_prediction_metrics
> >    File "/home/xeon/repositories/git/medusa-2.0/medusa/scheduler/predictionranking.py", line 6, in <module>
> >      import hdfs
> 
> Hello,
> 
> Can you try to set your PYTHONPATH like that:
> 
> export PYTHONPATH=${PYTHONPATH}:${MEDUSA_HOME}
> 
> Regards
> Karim

Thanks.

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


Thread

Path problems when I am in bash xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 15:21 -0800
  Re: Path problems when I am in bash Karim <kliateni@gmail.com> - 2015-12-30 03:30 +0100
    Re: Path problems when I am in bash xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-30 03:17 -0800

csiph-web