Skip to content

TypeError: can't concat bytes to list #10

Description

@setop

When running a program which loads data, such as helloworld, I get a TypeError :

$ ./golf.py examples/helloworld.bin 
Traceback (most recent call last):
  File "./golf.py", line 230, in <module>
    ret = golf.run()
  File "./golf.py", line 204, in run
    self.execute_instr(instr_name, instr_args)
  File "./golf.py", line 151, in execute_instr
    elif instr == "lbu":  self.regs[args[0]] = self.load(args[1], 1)
  File "./golf.py", line 89, in load
    return struct.unpack_from("<" + fmts[width], bytes(r + [0] * width))[0]
TypeError: can't concat bytes to list

I have been able to fix it by changing line 89 to :

return struct.unpack_from("<" + fmts[width], bytes(list(r) * width))[0]

I use python 3.4.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions