Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100975 > unrolled thread
| Started by | xeon Mailinglist <xeonmailinglist@gmail.com> |
|---|---|
| First post | 2015-12-29 15:21 -0800 |
| Last post | 2015-12-30 03:17 -0800 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.python
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
| From | xeon Mailinglist <xeonmailinglist@gmail.com> |
|---|---|
| Date | 2015-12-29 15:21 -0800 |
| Subject | Path problems when I am in bash |
| Message-ID | <09513926-226a-4099-a9d4-775ba4b09beb@googlegroups.com> |
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
[toc] | [next] | [standalone]
| From | Karim <kliateni@gmail.com> |
|---|---|
| Date | 2015-12-30 03:30 +0100 |
| Message-ID | <mailman.65.1451442628.11925.python-list@python.org> |
| In reply to | #100975 |
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
[toc] | [prev] | [next] | [standalone]
| From | xeon Mailinglist <xeonmailinglist@gmail.com> |
|---|---|
| Date | 2015-12-30 03:17 -0800 |
| Message-ID | <ca287ff7-fa27-447f-a124-5f84de331020@googlegroups.com> |
| In reply to | #100978 |
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.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web