In test.py, sto cercando di importare test_data:ImportError: No module named test_data, ma test_data.py nella stessa directory test.py sotto PyCharm utilizzando virtualenv
import unittest2
import re
from test_data import receipt1_example
test_data.py è nella stessa directory di test.py. Ottengo il seguente errore:
/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::test true Testing started at 11:30 AM ... Traceback (most recent call last):
File "/Applications/PyCharm.app/helpers/pycharm/utrunner.py", line 121, in module = loadSource(a[0]) File "/Applications/PyCharm.app/helpers/pycharm/utrunner.py", line 44, in loadSource module = imp.load_source(moduleName, fileName) File "/Users/ahammond/src/hackfest_spring_2012/parse_me/test.py", line 4, in from test_data import receipt1_example ImportError: No module named test_dataProcess finished with exit code 1
Come potete vedere, sto facendo funzionare questo sotto PyCharm utilizzando un virtualenv. Ecco uno screenshot della configurazione:
Brutto, ma funziona. Grazie! Er, ovviamente usando da test_data import receipt1_example – Andrew