There are answers here: https://stackoverflow.com/questions/1153...th-init-py but I don't really understand them.
My directory structure is as follows:
quantity_pred and tfidf_transformer are imported without any problems, but when importing model_helpers I get the following error:
SOLVED
My directory structure is as follows:
Output:dir1/
__init__.py
model_helpers.py
quantity_pred_pickle.py
quantity_pred.py
tfidftransformer.py
Inside quantity_pred_pickle.py I have the following:1 2 3 |
import quantity_pred import tfidf_transformer import model_helpers |
Output:MacBook-Air:ff_nlp_trained_models Olly$ python quantity_pred_pickle.py
Traceback (most recent call last):
File "quantity_pred_pickle.py", line 14, in <module>
from model_helpers import train_clf
File "/Users/Olly/Documents/MSc/Natural Language Processing/Dissertation/dir1/model_helpers.py", line 14, in <module>
from .tfidftransformer import TfIdfTransformer
ValueError: Attempted relative import in non-package
How can I solve this? Why is it occurring? Thanks.SOLVED