TypeError: argument should be bytes, buffer or ASCII string, not 'NoneType'
-
Trying to connect to Azure but getting
TypeError: argument should be bytes, buffer or ASCII string, not 'NoneType'
for the sas key -
Hi,
Could you paste your code?
-
@IAMLIUBO
This is the simple code that generates the error:from m5stack import * from m5stack_ui import * from uiflow import * from IoTcloud.Azure import IoT_Hub screen = M5Screen() screen.clean_screen() screen.set_screen_bg_color(0xFFFFFF) azure = IoT_Hub(connection_string='HostName=UIFlow.azure-devices.net;DeviceId=M5Stack_AWS;SharedAccessSignature=SharedAccessSignature sr=UIFlow.azure-devices.net%2Fdevices%2FM5Stack_AWS&sig=R22UG%2Bf6uGEIq4Z0Rty1QCU9OWVq5R3%2FUrOUN9ogGgE%3D&se=1644387423')
And don't worry as the string has already been locked.
-
Hi @ajb2k3
Please try use Primary Connection String:
-
Thanks I have been trying to use an sas key instead of the pcs key as that what the label says. Please change sas to pcs
-
Actually SAS is a authentication type, we use Primary Connection String calculate the sas_token, supports passing two parameters "connection_string" and "sas_token", but "sas_token" can be calculated by "connection_string", so block omits the second parameter, but connection_string is essential.
e.g.
azure = IoT_Hub(connection_string="xxxxxxx", sas_token="xxxxxxx")
-
@iamliubo yeh I managed to work out that SAS stands for Secure Access String buts it’s confusing for new people to label the block as SAS when it’s actually the PCS code that has to be typed in. I’ll try the primary key tonight when I get back to the shop.
-
Is this better?
-
@iamliubo Much, much better thank you!
-
So I loose the error but have no sign that its connecting, I have a monitor running is VSCode but it show no sign of the core connecting.