Skip to content

cast_to function unable to process NoneType values #5

@PatrickElmer

Description

@PatrickElmer

If you type hello world --times by mistake in the example from the readme, you get the following error:

Traceback (most recent call last):
  File "/tmp/m/.venv/bin/hello", line 5, in <module>
    from module import hello
  File "/tmp/m/module.py", line 11, in <module>
    import magicli
  File "/tmp/m/.venv/lib/python3.12/site-packages/magicli.py", line 201, in <module>
    raise SystemExit(magicli(frame_globals=frame.f_globals))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/m/.venv/lib/python3.12/site-packages/magicli.py", line 19, in magicli
    kwargs = get_kwargs(argv, function, help_message)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/m/.venv/lib/python3.12/site-packages/magicli.py", line 154, in get_kwargs
    kwargs[key] = cast_to(value)
                  ^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions