-
Notifications
You must be signed in to change notification settings - Fork 3k
tools/utils: Fix issue with loading json files as ascii on python3 linux #8177
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
Conversation
Ooh, nice! @andrewleech Isn't the use of the |
@cmonr good call, looks like I should be using the matching method from |
ec7e176
to
b663c5d
Compare
Well that was simple. Turns out |
Gonna test this against all other Python versions we support tomorrow, but assuming nothing bad is found, will start CI on it. |
Any updates? |
b663c5d
to
41ff7b9
Compare
@andrewleech My bad. Started looking into this, and found more issues that needed to be fixed, right before I left for a week. Let's get this in to unblock you, and I'll continue working on those other issues. |
Sounds good! |
/morph build |
Build : SUCCESSBuild number : 3285 Triggering tests/morph test |
Test : SUCCESSBuild number : 3092 |
Exporter Build : SUCCESSBuild number : 2910 |
/morph mbed2-build |
Description
This resolves #7026, a failure to run mbed-cli tool on linux python 3.5 due to the error:
This problem was accidentally introduced in 7b49edc when the recursive function which called
str.encode('ascii').decode()
was essentially replaced with a one liner which callsstr.encode('ascii', 'ignore')
without any conversion back to string. It appears some versions / platforms of python handle bytes being passed into json.loads while others don't (it's supposed to take str)This method is also somewhat inefficient however (though still better than the recursive function). Reading in the file and converting a couple of times before sending into json in unneccesary, the builtin codecs module gives us a much cleaner way of achieving the same goal
Pull request type