Giter VIP home page Giter VIP logo

Comments (5)

timothycrosley avatar timothycrosley commented on May 22, 2024

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.

michaelbuckner avatar michaelbuckner commented on May 22, 2024

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?
screen shot 2015-08-16 at 3 04 04 pm

Any ideas?

from hug.

timothycrosley avatar timothycrosley commented on May 22, 2024

Hi @michaelbuckner,

Sorry for the delay! It looks like there was a bug when using -f instead of -m that has been fixed here:

#52

also I added an example in that pull request of a file successfully being imported.

Thanks!

~Timothy

from hug.

timothycrosley avatar timothycrosley commented on May 22, 2024

Note this is in the just pushed to PyPI 1.2.0 release :)

from hug.

michaelbuckner avatar michaelbuckner commented on May 22, 2024

@timothycrosley Awesome, thanks so much!

from hug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.