Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have problems when using the cli decorator #808

Closed
silpatflogan opened this issue Jun 13, 2019 · 2 comments · Fixed by #809
Closed

I have problems when using the cli decorator #808

silpatflogan opened this issue Jun 13, 2019 · 2 comments · Fixed by #809

Comments

@silpatflogan
Copy link

silpatflogan commented Jun 13, 2019

I have the following script

import hug

def find_feed_name_from_email(email):
    qry = """SELECT feed_name FROM users WHERE email = '{}' ORDER BY id""".format(email)
    row = engine.execute(qry).first()
    print(qry)

@hug.cli()
@hug.get(examples="email=yayakuri@hotmail.com")
@hug.local()
def get_report_by_email(email: hug.types.text, hug_timer=3):
    feed_name=find_feed_name_from_email(email)
    print(feed_name)

if __name__ == '__main__':
     get_report_by_email.interface.cli()

But, when I execute this...

hug -f hug_cli_test.py -c get_report_by_email "asdf"

I get the following

SELECT feed_name FROM users WHERE email = '/Users/username/Library/Caches/pypoetry/virtualenvs/env/bin/hug' ORDER BY id

Is there something That I am not doing right?

I'm running this whit poetry in macOS

@timothycrosley
Copy link
Collaborator

This should be fixed in the just released Hug 2.5.5, thank you for reporting!

@silpatflogan
Copy link
Author

Thank you, it did!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants