[rcw,2/3] rcw.py: Fix using ord on ints

Message ID 20220405163507.3907691-3-sean.anderson@seco.com
State New
Headers show
Series Fix python 2->3 errors when using -r | expand

Commit Message

Sean Anderson April 5, 2022, 4:35 p.m. UTC
Iterating over a bytestring will yield integers in python 3, so we don't
need to convert them with ord(). This avoids the following error:

> TypeError: ord() expected string of length 1, but int found

Fixes: 7c47f30 ("Add support of Gen3 family SoCs")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

 rcw.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/rcw.py b/rcw.py
index 266a44f..42a11dc 100755
--- a/rcw.py
+++ b/rcw.py
@@ -811,7 +811,7 @@  def create_source():
     # After this stage, all the RCW bits should be formatted with lsb on
     # the right side and msb on the left side to permit conversion into
     # a very long uint.
-    bitstring = ''.join(['{0:08b}'.format(ord(x)) for x in bitbytes])[::-1]
+    bitstring = ''.join(['{0:08b}'.format(x) for x in bitbytes])[::-1]
     bits = int(bitstring, 2)
 
     # Loop over all the known symbols