Skip to content

a7800 is not building with Python 3.9 and newer #22

@smesgr9000

Description

@smesgr9000

A7800 is not building with Python3.9 or newer with the following error:

Traceback (most recent call last):
File "/home/sme/code/atari7800/a7800/scripts/build/msgfmt.py", line 291, in
main()
File "/home/sme/code/atari7800/a7800/scripts/build/msgfmt.py", line 287, in main
make(filename, outfile)
File "/home/sme/code/atari7800/a7800/scripts/build/msgfmt.py", line 254, in make
output = generate()
^^^^^^^^^^
File "/home/sme/code/atari7800/a7800/scripts/build/msgfmt.py", line 115, in generate
output += array.array("i", offsets).tostring()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'array.array' object has no attribute 'tostring'

this duplicate function was removed in 3.9 see: https://docs.python.org/3.9/whatsnew/3.9.html#removed

diff --git a/scripts/build/msgfmt.py b/scripts/build/msgfmt.py
index deb02ae3..a00596f6 100644
--- a/scripts/build/msgfmt.py
+++ b/scripts/build/msgfmt.py
@@ -112,7 +112,7 @@ def generate():
                          7*4,               # start of key index
                          7*4+len(keys)*8,   # start of value index
                          0, 0)              # size and offset of hash table
-    output += array.array("i", offsets).tostring()
+    output += array.array("i", offsets).tobytes()
     output += ids
     output += strs
     return output

fixes this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions