-
-
Notifications
You must be signed in to change notification settings - Fork 598
TypeError: isinstance() arg 2 must be a type or tuple of types #296
Description
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