Python不一致问题-Adafruit io

问题描述

所以我有一个简单的代码块:

# Import library and create instance of REST client.
from Adafruit_IO import Client,Feed
aio = Client('aio_bleepbloop')

# Get list of Feeds.
Feeds = aio.Feeds()

# Print out the Feed names:
for f in Feeds:
    print('Feed: {0}'.format(f.name))

daTaroll = aio.receive('diceRoll').value
dataType = aio.receive('diceType').value
print(daTaroll,dataType)

在一台运行python 3.7.4的PC上,jsut可以正常运行,并且在我的运行3.8.5的家用PC上出现此错误

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-10-41fb818ed5ba> in <module>
      1 # Import library and create instance of REST client.
      2 from Adafruit_IO import Client,Feed
----> 3 aio = Client('aio_bleepbloop')
      4 
      5 # Get list of Feeds.

TypeError: __init__() missing 1 required positional argument: 'key'

我真不知道为什么。

解决方法

您可以尝试

aio = Client("username","aio_bloopbloop")