HDFGroup / h5serv

Reference service implementation of the HDF5 REST API
Other
168 stars 35 forks source link

implicit relative imports cause errors when server package is imported in Python 3 script #122

Closed telamonian closed 5 years ago

telamonian commented 5 years ago

I just installed the server package from this project and then tried to do from server import app in a Python 3 script. This doesn't work, and results in an error:

ModuleNotFoundError: No module named 'config'

I did some googling, and here's what I came up with: implicit relative imports (eg import config in server/app.py) aren't valid in Python 3. Confusingly, they still appear to work in certain circumstances (like when you run python app.py), but that's down to the details of how sys.path is set in that specific case (tldr; they actually function as absolute important statements under these conditions).