ValueError: Attempted relative import in non-package - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: ValueError: Attempted relative import in non-package (/thread-8799.html) |
ValueError: Attempted relative import in non-package - JoeB - Mar-08-2018 There are answers here: https://stackoverflow.com/questions/11536764/how-to-fix-attempted-relative-import-in-non-package-even-with-init-py but I don't really understand them. My directory structure is as follows: Inside quantity_pred_pickle.py I have the following:import quantity_pred import tfidf_transformer import model_helpersquantity_pred and tfidf_transformer are imported without any problems, but when importing model_helpers I get the following error: How can I solve this? Why is it occurring? Thanks.SOLVED RE: ValueError: Attempted relative import in non-package - Gribouillis - Mar-08-2018 You can perhaps remove the dot in from .tfidftransformer import TfIdfTransformer
|