Skip to content

Unable to pass argument with space to cell magic #12729

@memeplex

Description

@memeplex

Cython defines this argument for the %%cython margin:

    @magic_arguments.argument(
        '--link-args', action='append', default=[],
        help="Extra flags to pass to linker via the `extra_link_args` "
             "Extension flag (can be specified  multiple times)."
    )

But trying to pass %%cython --link-args="-L/Users/carlos/Desktop/Test LGBM API" I get:

UsageError: unrecognized arguments: LGBM API"

If I mimic what I believe this should be doing, I get:

EDIT: there is a typo in this code, please see comments below.

In [15]: l = shlex.shlex('%%cython --link-args="-L/Users/carlos/Desktop/Test LGBM API"', posix=False)

In [16]: a.whitespace_split=True

In [17]: a.commenters=''

In [18]: list(l)
Out[18]:
['%',
 '%',
 'cython',
 '-',
 '-',
 'link',
 '-',
 'args',
 '=',
 '"-L/Users/carlos/Desktop/Test LGBM API"']

which seems fine.

My system is MacOS 11.0.1. I'm using python 3.8.6 with ipython 7.19.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions