import binascii if ubinascii not found#111
Open
jerryneedell wants to merge 2 commits intoscientifichackers:masterfrom
Open
import binascii if ubinascii not found#111jerryneedell wants to merge 2 commits intoscientifichackers:masterfrom
jerryneedell wants to merge 2 commits intoscientifichackers:masterfrom
Conversation
|
I have no authority here, but issue #110 is something that has been annoying in ampy for some time. I have implemented the above fix locally and confirm that it works and is non-breaking for micropython devices as well. |
|
For what it's worth, I tested this on an HUZZAH32 V2 running:
I was unable to make this work, it appears that the left over item is now: # files.py
def get(self, filename):
"""Retrieve the contents of the specified file and return its contents
as a byte string.
"""
# Open the file and read it a few bytes at a time and print out the
# raw bytes. Be careful not to overload the UART buffer so only write
# a few bytes at a time, and don't use print since it adds newlines and
# expects string data.
command = """
import sys
import binascii
with open('{0}', 'rb') as infile:
while True:
result = infile.read({1})
if result == b'':
break
# len = sys.stdout.write(ubinascii.hexlify(result))
# use actual binascii
len = sys.stdout.write(binascii.hexlify(result))The above patch correct it for me, which I assume is just a missed merge between your changes and the circuit python project. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
addresses #110
Circuitpython now uses binascii so the "get" command fails trying to import ubinascii.
This PR adds a try/except to import binascii as ubinascii if ubinascii is not present.