I'm working on Mac Os Sierra 10.12.6, python 3.7.2 and uvicorn via pip3 0.5.1.
When I run the example uvicorn app:App get the following error:
Traceback (most recent call last):
File "/usr/local/bin/uvicorn", line 11, in
load_entry_point('uvicorn==0.5.1', 'console_scripts', 'uvicorn')()
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
return ep.load()
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2411, in load
return self.resolve()
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2417, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python3.7/site-packages/uvicorn/__init__.py", line 2, in
from uvicorn.main import Server, main, run
File "/usr/local/lib/python3.7/site-packages/uvicorn/main.py", line 212, in
ssl_ciphers: str,
File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 170, in decorator
_param_memo(f, OptionClass(param_decls, *attrs))
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1460, in __init__
Parameter.__init__(self, param_decls, type=type, *attrs)
TypeError: __init__() got an unexpected keyword argument 'hidden'
Thank you
@adriangallegos Not a maintainer, but I think providing a minimum example application and full command listing allowing to reproduce this error would help people to help you. :-)
Thank you @florimondmanca
I tried with the example:
class App():
def __init__(self, scope):
assert scope['type'] == 'http'
self.scope = scope
async def __call__(self, receive, send):
await send({
'type': 'http.response.start',
'status': 200,
'headers': [
[b'content-type', b'text/plain'],
]
})
await send({
'type': 'http.response.body',
'body': b'Hello, world!',
})
I then run uvicorn app:App
Thanks in advance !!!
Ah right, I didn't realise it was the example app from the quickstart.
On my end, I'm able to run this without issues. I have the same config as yours except the macOS version (I have 10.14).
The traceback suggests this is an issue with click. I notice uvicorn's setup.py doesn't pin any minimal version for click, and you seem to use a global installation of uvicorn here. Did you already have click installed? Which version is it? Maybe try upgrading it via pip install -U click?
Thank you @florimondmanca. It's works !!!
I've version 6.7 and now 7.0
Thanks !!!
Cool! I've tried using click==6.7 and I was able to reproduce this bug.
After inspecting the source code in main.py, this comes from the --debug option that uses hidden=True. The hidden parameter is only available for Click 7+ and can be used to "hide the option from help outputs" (see the Option API reference).
Not sure why we'd want to hide --debug from --help, but if this needs to stay then uvicorn should probably pin Click to >=7.
Not sure why we'd want to hide --debug from --help
Because 鈥攔eload is what we want to recommend. Debug should be an application-level setting, and we鈥檒l deprecate I here.
but if this needs to stay then uvicorn should probably pin Click to >=7.
Yup we need to do that.
Most helpful comment
Because 鈥攔eload is what we want to recommend. Debug should be an application-level setting, and we鈥檒l deprecate I here.
Yup we need to do that.