python import breaks in server environment but works fine on my computer -
i have research server using run python scripts. server has python 2.4. problem when try run tests on server, breaks on import statements. file structure this:
|-- readme.md |-- poly.py `-- tests |-- __init__.py |-- test_foil.py
tests/__init__.py
looks like
from test_foil import * unittest.main()
and test_foil.py
looks like
import unittest poly import poly
on computer, when run python tests/__init__.py
tests execute. when run on server error
from test_foil import * traceback (most recent call last): file "tests/__init__.py", line 1, in ? test_foil import * file "/home/simon_team/partition_poly/tests/test_foil.py", line 2, in ? poly import poly importerror: no module named poly
it not 100% critical run tests on server, convenient way of making sure code 2.4 compatible before running actual code. can't life of me figure out why behaving differently on 2 machines, since docs don't indicate behavoir of import
changed 2.4 2.7
import sys sys.path.append("path_to_directory") poly import poly
Comments
Post a Comment