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

TypeError: Invalid first argument to register() #895

Closed
charterchap opened this issue Jul 2, 2018 · 3 comments · Fixed by #917
Closed

TypeError: Invalid first argument to register() #895

charterchap opened this issue Jul 2, 2018 · 3 comments · Fixed by #917

Comments

@charterchap
Copy link

charterchap commented Jul 2, 2018

  • Description of issue
    Using Python 3.7.0, Can not import niswitch (0.9.0 and 1.0.0)

import niswitch
C:\Program Files (x86)\Python37-32\lib\site-packages\niswitch\init.py:7: in
from niswitch.session import Session # noqa: F401
C:\Program Files (x86)\Python37-32\lib\site-packages\niswitch\session.py:7: in
import niswitch._attributes as _attributes
C:\Program Files (x86)\Python37-32\lib\site-packages\niswitch_attributes.py:3: in
import niswitch._converters as _converters
C:\Program Files (x86)\Python37-32\lib\site-packages\niswitch_converters.py:54: in
@_convert_repeated_capabilities.register(six.string_types) # noqa: F811
C:\Program Files (x86)\Python37-32\lib\functools.py:801: in register
f"Invalid first argument to register(): {cls!r}. "
E TypeError: Invalid first argument to register(): (<class 'str'>,). Use either @register(some_class) or plain @register on an annotated function.
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!
```

  • Steps to reproduce issue

    import niswitch

This may be of interest:
python/cpython@e569753

@marcoskirsch
Copy link
Member

marcoskirsch commented Jul 3, 2018

  1. Do you have numpy? I'm wondering if it is related to numpy 1.15.0rc1 breaks loading some DLLs #894
  2. You mention niswitch only. Is that because that's the only module from nimi-python that you tried, or because it is the only one that broke? I'm wondering if it's something specific to niswitch or if the issue affects all modules.
  3. Does this work on other Python versions, or have you not tried it? Wondering if it's an installation-specific problem.
  4. Are you using a 64-bit or 32-bit Python?

@charterchap
Copy link
Author

charterchap commented Jul 9, 2018

It does work fine with python 3.6.5. I do have numpy installed. niswitch is the first of the nimi-python imports, so i'm not sure if the others have the same problem (i've since downgraded python).
Take a look at the commit in the python code base from my original post. I think they changed something on you with @register.

@charterchap
Copy link
Author

python/cpython#4733

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants