test.pyで、test_dataをインポートしようとしています。
import unittest2
import re
from test_data import receipt1_example
test_data.pyはtest.pyと同じディレクトリにあります。次のエラーが発生します。
/Users/ahammond/.virtualenvs/ric2.6/bin/python2.6 /Applications/PyCharm.app/helpers/pycharm/utrunner.py/Users/ahammond/src/hackfest_spring_2012/parse_me/test.py::testtrueテスト午前11時30分に開始...トレースバック(最後の最後の呼び出し):
ファイル "/Applications/PyCharm.app/helpers/pycharm/utrunner.py"、行121、モジュール= loadSource(a [0])ファイル " /Applications/PyCharm.app/helpers/pycharm/utrunner.py "、44行目、loadSourceモジュール= imp.load_source(moduleName、fileName)ファイル" /Users/ahammond/src/hackfest_spring_2012/parse_me/test.py "、行4、test_dataからインポートreceipt1_example ImportError:test_dataという名前のモジュールがありませんプロセスは終了コード1で終了しました
ご覧のとおり、virtualenvを使用してpycharmでこれを実行しています。構成のスクリーンショットは次のとおりです。