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

constructor_interceptor func strips required kwargs #7

Closed
djanderson opened this issue Jun 20, 2014 · 1 comment
Closed

constructor_interceptor func strips required kwargs #7

djanderson opened this issue Jun 20, 2014 · 1 comment

Comments

@djanderson
Copy link

Python 2.7.6 (default, Mar 22 2014, 22:59:38) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gnuradio import gr,uhd
linux; GNU C++ version 4.8.2; Boost_105400; UHD_003.007.001-20-unstable

>>> amsg_src = uhd.amsg_source(device_addr="", msgq=gr.msg_queue())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/gnuradio/uhd/__init__.py", line 122, in constructor_interceptor
    return old_constructor(*args)
  File "/usr/lib/python2.7/dist-packages/gnuradio/uhd/uhd_swig.py", line 2721, in make
    return _uhd_swig.amsg_source_make(*args, **kwargs)
TypeError: Required argument 'msgq' (pos 2) not found

uhd.amsg_source returns the constructor_interceptor function:

def constructor_interceptor(*args, **kwargs):
    args = list(args)
    kwargs = dict(kwargs)
    for (index, key, cast) in (
           (0, 'device_addr', device_addr), 
           (1, 'io_type', io_type)):
        try:
            if len(args) > index: args[index] = cast(args[index])
            if kwargs.has_key(key): kwargs[key] = cast(kwargs[key])
        except:
            pass

                # dont pass kwargs, it confuses swig, map into args list:

    for key in ('device_addr', 'stream_args', 'io_type', 'num_channels'):
        if kwargs.has_key(key): args.append(kwargs[key])
    return old_constructor(*args)

The hard coded list of kwargs is not passing the required "msgq".

It will go through by only using args, as in: amsg_src = uhd.amsg_source("", gr.msg_queue()), however the UHD: USRP Async Msg Source block for GRC tries to pass msgq via kwarg, so it is unusable without editing the source.

@bhilburn
Copy link
Contributor

Hi @Daguu - thanks for the bug-report! We don't track GR-UHD bugs here, though, they are tracked on GNURadio's bug tracker. Can you re-file there, please? http:https://gnuradio.org/redmine/projects/gnuradio/issues

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

No branches or pull requests

2 participants