Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fromstring is removed in python 3.9 #716

Closed
mnumanuyar opened this issue Aug 10, 2022 · 3 comments · Fixed by #748
Closed

fromstring is removed in python 3.9 #716

mnumanuyar opened this issue Aug 10, 2022 · 3 comments · Fixed by #748

Comments

@mnumanuyar
Copy link

fromstring is removed from python 3.9. (changelog)
related issue: python/cpython#83097

currently mavutil has an instance of it

byte_buf.fromstring(buf)

running it produces error:
"'array.array' object has no attribute 'fromstring' python"

I changed the line as

            if type(buf) == bytes: 
                byte_buf.frombytes(buf)
            elif type(buf) == str: 
                byte_buf.fromlist(list(buf.encode('utf8')))

in my local, which solved error. But I have no clue if this is correct, and I have not tested it well

@alehed
Copy link
Contributor

alehed commented Nov 2, 2022

This error should have been resolved by #666 which is now merged.

@mnumanuyar
Copy link
Author

mnumanuyar commented Nov 3, 2022

that line is still in the master branch, did the merge somehow made that line unaccesible ?

byte_buf.fromstring(buf)

@alehed
Copy link
Contributor

alehed commented Nov 3, 2022

Ah, true. I was thinking about the generated code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants