-1
我遇到__import__
方法的问题。它似乎只导入模块的基本目录,而不是文件。__import__只能导入__init__.py
比如我有:
test_suite/assert_array_length.py
当我通过这个到__import__
:
moduleLocation = "test_suite.assert_array_length"
module = __import__(moduleLocation)
print module
我越来越:
[sub_directories]/test_suite/__init__.pyc
调用序列会从run_tests.py
到test_runner.py
。 test_runner.py
然后进口assert_array_length.py
。他们制定了这样的:
run_tests.py
|-----------test_runner.py
|-----------assert_array_length.py
,因为它导入__init__.py
,我不能让我从assert_array_length.py
文件需要。
非常感谢。这工作完美。 –