Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bytearray questions
#3
Thanks for the suggestion DeaD_EyE,

I tried:

import binascii
readable_data = binascii.b2a_hex(bytearray(b'K\x01\x01\x00\x00\x08\x04\x97*f9'))
print(readable_data)
And unfortunately get the following error:

Error:
Traceback (most recent call last): File "nfc-test2.py", line 23, in status_check readable_data=binascii.b2a_hex(card_data) TypeError: a bytes-like object is required, not 'int'
I'd also like to know what the x97*f9 means in the bytearray and how that translates to "readable data", so can answer the question myself next time and not have to bug anyone. Wink

Scratch that! The last thing I did yesterday was to annotate out the the data being passed from the byte array and replace it with the frame length!

Switched it back and got the expected result!

Thanks again DeaD_EyE
Reply


Messages In This Thread
Bytearray questions - by mattps - Mar-24-2018, 06:02 PM
RE: Bytearray questions - by DeaD_EyE - Mar-24-2018, 06:43 PM
RE: Bytearray questions - by mattps - Mar-25-2018, 06:54 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Value error when converting hex value to bytearray shubhamjainj 7 10,549 Mar-20-2023, 05:30 PM
Last Post: Skaperen
  appending to a bytearray Skaperen 21 14,445 Mar-19-2023, 11:05 PM
Last Post: Skaperen
  Split Bytearray into separate Files by Hex delimter lastyle 5 2,673 Mar-09-2023, 07:49 AM
Last Post: bowlofred
  Save multiple Parts of Bytearray to File ? lastyle 1 960 Dec-10-2022, 08:09 AM
Last Post: Gribouillis
  bytearray object - why converting to ascii? Chepilo 2 1,642 Nov-21-2022, 07:25 PM
Last Post: Chepilo
  Bytearray substitution Vismuto 1 2,627 Apr-14-2020, 09:18 AM
Last Post: TomToad
  int() function with bytearray() Jona66 1 2,404 Sep-08-2019, 12:41 PM
Last Post: ichabod801
  Conversion needed from bytearray to Floating point braveYug 1 4,127 May-07-2018, 12:23 PM
Last Post: snippsat
  Windows DIB format in bytearray to image? dusca 2 2,772 Mar-28-2018, 10:35 PM
Last Post: dusca
  ByteArray outside while true Schampbakken 5 4,389 Feb-18-2018, 02:02 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020