Skip to content

Commit

Permalink
Merge pull request #181 from jerryneedell/jerryn_binascii
Browse files Browse the repository at this point in the history
import binascii if ubinascii not found

- Thanks for the PR
  • Loading branch information
dhylands authored Apr 12, 2022
2 parents b0acaaf + 98a2a6e commit 76ccf58
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions rshell/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,10 @@ def set_time(rtc_time):
def recv_file_from_host(src_file, dst_filename, filesize, dst_mode='wb'):
"""Function which runs on the pyboard. Matches up with send_file_to_remote."""
import sys
import ubinascii
try:
import ubinascii
except:
import binascii as ubinascii
import os
if HAS_BUFFER:
try:
Expand Down Expand Up @@ -1182,7 +1185,10 @@ def recv_file_from_remote(dev, src_filename, dst_file, filesize):
def send_file_to_host(src_filename, dst_file, filesize):
"""Function which runs on the pyboard. Matches up with recv_file_from_remote."""
import sys
import ubinascii
try:
import ubinascii
except:
import binascii as ubinascii
try:
with open(src_filename, 'rb') as src_file:
bytes_remaining = filesize
Expand Down Expand Up @@ -1233,7 +1239,10 @@ def test_readinto():

def test_unhexlify():
"""Checks the micropython firmware to see if ubinascii.unhexlify exists."""
import ubinascii
try:
import ubinascii
except:
import binascii as ubinascii
try:
_ = ubinascii.unhexlify
return True
Expand Down

0 comments on commit 76ccf58

Please sign in to comment.