pycom / pycom-libraries

MicroPython libraries and examples that work out of the box on Pycom's IoT modules
330 stars 379 forks source link

Faulty code doesn't work #150

Closed dnear1 closed 3 years ago

dnear1 commented 3 years ago

https://github.com/pycom/pycom-libraries/blob/b92cea79b32fc89bff4153f5f5f0840a988a52d2/shields/pysense_2.py#L51

says print("Light (channel Blue, channel Red): " + str(lt.light()," Lux: ", str(lt.lux()), "lx"))

Should say print("Light (channel Blue, channel Red): " + str(lt.light()) + " Lux: " + str(lt.lux()) + "lx")

Does anyone even test this stuff?

gijsio commented 3 years ago

I personally tested all the codes and dont know how this mistake still slipped in (you're refering to the misplaced) for str right?). I'll correct it, thanks for higlighting and sorry for the inconvenience.

dnear1 commented 3 years ago

The missing end bracket was at the end of the statement, not after lt.light(), and I had to change the 3 ',' to '+' to get it to run

gijsio commented 3 years ago

The issue is fixed now. Thanks again. I will close the issue here. Just to confirm, it can work with + inside the str(...) block, or (, and +) inside the print(...) as a string delimiter. The comma will add spaces, while the plus will directly concatenate strings