Comments (5)
Hi @michaelbuckner,
Hug APIs should work fine with import external modules, as long as their in the current Python PATH. Is Person in the same directory? Does it have the folder have an __init__.py
file? Is it the root python directory, or do you need to use relative imports to load it?
Thanks! And I hope these questions help you diagnose your problem
Tim
from hug.
Hi @timothycrosley, thanks for taking the time to help.
Person is in the same directory, I've tried both import Person
as well as from . import Person
I've tried both with and without an init.py file, both in the root of the project, as well as in a module.
Here's what I get with a relative import:
File "app.py", line 4, in <module>
from . import Person
SystemError: Parent module '' not loaded, cannot perform relative import
Any ideas?
from hug.
Hi @michaelbuckner,
Sorry for the delay! It looks like there was a bug when using -f
instead of -m
that has been fixed here:
also I added an example in that pull request of a file successfully being imported.
Thanks!
~Timothy
from hug.
Note this is in the just pushed to PyPI 1.2.0 release :)
from hug.
@timothycrosley Awesome, thanks so much!
from hug.
Related Issues (20)
- zsh: command not found: hug HOT 1
- How to configure a service?
- Bug: dashed versions of valid command line arguments fail silently
- Add exception in not_found router
- Missing explicit python 3.8 compatibility from release note.
- GET endpoints not working when using prefixes in @hug.object.urls
- Tag the source
- Remove pinning
- pytest-runner not required HOT 1
- distutils has been deprecated in Python 3.10 HOT 1
- Is this project abandoned? HOT 8
- Unexpected conversion during a requests.post() operation
- TypeError: gather() got an unexpected keyword argument 'loop' HOT 2
- CORS Middleware help
- Exception handler: Why find a potential handler doesn't exit the loop
- Implementation bugs for exception catching!
- FYI: cgi module is deprecated in Python 3.11, will be removed in 3.13
- Could you please clarify this deprecation warning?! HOT 2
- How to prevent GET requests logging only? HOT 3
- Inconsistent indentation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hug.