sanic icon indicating copy to clipboard operation
sanic copied to clipboard

Can't use optional CLI arguments

Open ruckc opened this issue 6 months ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

When I try sanic module:app it works. When I try sanic -d module:app it doesn't. Trying --dev doesn't work. I can run with -r and --debug separately.

$ sanic testapp:app --dev
[2024-01-04 15:39:58 -0500] [19499] [INFO] 
  ┌─────────────────────────────────────────────────────────────────────────────────────────────────────┐
  │                                            Sanic v23.12.0                                           │
  │                                  Goin' Fast @ http://127.0.0.1:8000                                 │
  ├───────────────────────┬─────────────────────────────────────────────────────────────────────────────┤
  │                       │         app: testapp                                                        │
  │     ▄███ █████ ██     │        mode: debug, single worker                                           │
  │    ██                 │      server: sanic, HTTP/1.1                                                │
  │     ▀███████ ███▄     │      python: 3.10.12                                                        │
  │                 ██    │    platform: Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35 │
  │    ████ ████████▀     │ auto-reload: enabled                                                        │
  │                       │    packages: sanic-routing==23.12.0, sanic-ext==23.12.0                     │
  │ Build Fast. Run Fast. │                                                                             │
  └───────────────────────┴─────────────────────────────────────────────────────────────────────────────┘

[2024-01-04 15:39:58 -0500] [19499] [DEBUG] Creating multiprocessing context using 'spawn'
[2024-01-04 15:39:58 -0500] [19499] [ERROR] Experienced exception while trying to serve
Traceback (most recent call last):
  File "/home/python/virtualenvs/testapp/lib/python3.10/site-packages/sanic/mixins/startup.py", line 1144, in serve
    trigger_events(ready, loop, primary)
  File "/home/python/virtualenvs/testapp/lib/python3.10/site-packages/sanic/server/events.py", line 35, in trigger_events
    loop.run_until_complete(result)
  File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
  File "/home/python/virtualenvs/testapp/lib/python3.10/site-packages/sanic/cli/app.py", line 160, in start_repl
    SanicREPL(app, self.args.repl).run()
  File "/home/python/virtualenvs/testapp/lib/python3.10/site-packages/sanic/cli/console.py", line 134, in __init__
    del variable_descriptions[3]
IndexError: list assignment index out of range
[2024-01-04 15:39:58 -0500] [19499] [INFO] Server Stopped
[2024-01-04 15:39:58 -0500] [19499] [DEBUG] Annyeong
Traceback (most recent call last):
  File "/home/python/virtualenvs/testapp/bin/sanic", line 8, in <module>
    sys.exit(main())
  File "/home/python/virtualenvs/testapp/lib/python3.10/site-packages/sanic/__main__.py", line 12, in main
    cli.run(args)
  File "/home/python/virtualenvs/testapp/lib/python3.10/site-packages/sanic/cli/app.py", line 121, in run
    serve(app)
  File "/home/python/virtualenvs/testapp/lib/python3.10/site-packages/sanic/mixins/startup.py", line 1144, in serve
    trigger_events(ready, loop, primary)
  File "/home/python/virtualenvs/testapp/lib/python3.10/site-packages/sanic/server/events.py", line 35, in trigger_events
    loop.run_until_complete(result)
  File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
  File "/home/python/virtualenvs/testapp/lib/python3.10/site-packages/sanic/cli/app.py", line 160, in start_repl
    SanicREPL(app, self.args.repl).run()
  File "/home/python/virtualenvs/testapp/lib/python3.10/site-packages/sanic/cli/console.py", line 134, in __init__
    del variable_descriptions[3]
IndexError: list assignment index out of range

Code snippet

No response

Expected Behavior

No response

How do you run Sanic?

Sanic CLI

Operating System

Linux

Sanic Version

23.12.0

Additional context

No response

ruckc avatar Jan 04 '24 20:01 ruckc