Navigation

    Welcome to the Pycom forum

    Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Tags
    3. typeerror
    Log in to post

    • T

      Float to bytearray conversion for sigfox payload
      Discussion • micropython sigfox typeerror • • tttadam  

      23
      0
      Votes
      23
      Posts
      3810
      Views

      robert-hh

      @jcaron I think that this was @tttadam's conclusion.
    • iber

      Read unsigned byte from the specified register I2C
      Comments & Feedback • i2c typeerror si1145 • • iber  

      2
      0
      Votes
      2
      Posts
      906
      Views

      iber

      Never mind I found the problem. It was actually in the line above paramVal = self._device.readfrom_mem(self._address, SI1145_REG_PARAMRD, 1)
    • A

      TypeError: can't convert 'str' object to str implicitly
      MicroPython • micropython typeerror cast • • Andrea Filippini  

      10
      0
      Votes
      10
      Posts
      4416
      Views

      G

      Python makes a clear distinction between bytes and strings . Bytes objects contain raw data — a sequence of octets — whereas strings are Unicode sequences . Conversion between these two types is explicit: you encode a string to get bytes, specifying an encoding (which defaults to UTF-8); and you decode bytes to get a string. Clients of these functions should be aware that such conversions may fail, and should consider how failures are handled. We can convert bytes to string using bytes class decode() instance method, So you need to decode the bytes object to produce a string. In Python 3 , the default encoding is "utf-8" , so you can use directly: b"python byte to string".decode("utf-8")
    • 1 / 1