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: isinstance() arg 2 must be a type or tuple of types #296

Closed
nzhou opened this issue Apr 2, 2018 · 3 comments
Closed

TypeError: isinstance() arg 2 must be a type or tuple of types #296

nzhou opened this issue Apr 2, 2018 · 3 comments

Comments

@nzhou
Copy link

nzhou commented Apr 2, 2018

My chuangmi plug v1 was discovered correctly, however, when I ran "miplug --ip $IP --token $TOKEN -d", I got the follow error:
File "/Users/ningzhou/anaconda/envs/tf/lib/python3.6/site-packages/click/core.py", line 449, in find_object
if isinstance(node.obj, object_type):
TypeError: isinstance() arg 2 must be a type or tuple of types

I have a vague impression that this has sth to do with Python 3 + Anaconda, but was not very sure. Or could it be from the deprecated object? isinstance should handle inheritance correctly though. Any hint where should I start to fix it? If I just comment out the line "if isinstance(node.obj, object_type):", miplug runs the commands correctly. Full debug output below:
INFO:miio.plug_cli:Debug mode active
/Users/nu/anaconda/envs/tf/lib/python3.6/site-packages/miio/plug_cli.py:37: DeprecationWarning: Call to deprecated class Plug (This device class is deprecated. Please use the ChuangmiPlug class in future and select a model by parameter 'model'.).
dev = miio.Plug(ip, token, debug)
DEBUG:miio.plug_cli:Connecting to 192.168.1.7 with token f5e37b3fa55657fa5e0d9ff0f41d4388
<miio.chuangmi_plug.Plug object at 0x11055e898>
<function Plug at 0x1103fe510>
Traceback (most recent call last):
File "/Users/nu/anaconda/envs/tf/bin/miplug", line 11, in
sys.exit(cli())
File "/Users/nu/anaconda/envs/tf/lib/python3.6/site-packages/miio/click_common.py", line 47, in call
return self.main(*args, **kwargs)
File "/Users/nu/anaconda/envs/tf/lib/python3.6/site-packages/click/core.py", line 699, in main
rv = self.invoke(ctx)
File "/Users/nu/anaconda/envs/tf/lib/python3.6/site-packages/click/core.py", line 1040, in invoke
return Command.invoke(self, ctx)
File "/Users/nu/anaconda/envs/tf/lib/python3.6/site-packages/click/core.py", line 892, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/nu/anaconda/envs/tf/lib/python3.6/site-packages/click/core.py", line 537, in invoke
return callback(*args, **kwargs)
File "/Users/nu/anaconda/envs/tf/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Users/nu/anaconda/envs/tf/lib/python3.6/site-packages/miio/plug_cli.py", line 43, in cli
ctx.invoke(status)
File "/Users/nu/anaconda/envs/tf/lib/python3.6/site-packages/click/core.py", line 537, in invoke
return callback(*args, **kwargs)
File "/Users/nu/anaconda/envs/tf/lib/python3.6/site-packages/click/decorators.py", line 59, in new_func
obj = ctx.find_object(object_type)
File "/Users/nu/anaconda/envs/tf/lib/python3.6/site-packages/click/core.py", line 449, in find_object
if isinstance(node.obj, object_type):
TypeError: isinstance() arg 2 must be a type or tuple of types

@AlbrtoSam
Copy link

I had exactly the same error.
Try this: miiocli chuangmiplug --ip ipadd --token yourtoken status

@kjw3898
Copy link

kjw3898 commented May 20, 2018

I had exactly the same error also
but not work with command miiocli
when you install with "pip install python-miio", you can't use miiocli (at least in my case)
solution:
type "pip uninstall python-miio" on cmd or terminal
download github zip flie -> unzip -> go to unzip path on cmd or terminal -> type "python setup.py install"

syssi added a commit to syssi/python-miio that referenced this issue May 20, 2018
@syssi
Copy link
Collaborator

syssi commented May 20, 2018

The command line tool "miplug" will be fixed with the release of python-miio 0.4.0. The new unified command line interface (miiocli) will be introduced with the release of version 0.4.0, too. Right now miiocli isn't part of the stable release. Please use miiocli in future. The old command line tools will resign some day.

@syssi syssi closed this as completed in 884ba12 May 20, 2018
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

4 participants