Skip to content

Commit fe28953

Browse files
Merge pull request #866 from bridadan/fix_non_mbed_lib
Fix handling of non mbed .lib files in Python 3
2 parents 52ed388 + e48707c commit fe28953

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

mbed/mbed.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,11 @@ def fromurl(cls, url, path=None):
10511051

10521052
@classmethod
10531053
def fromlib(cls, lib=None):
1054-
with open(lib) as f:
1055-
ref = f.read(200)
1054+
try:
1055+
with open(lib) as f:
1056+
ref = f.read(200)
1057+
except UnicodeDecodeError:
1058+
ref = ""
10561059

10571060
m_local = re.match(regex_local_ref, ref.strip().replace('\\', '/'))
10581061
m_repo_ref = re.match(regex_url_ref, ref.strip().replace('\\', '/'))

0 commit comments

Comments
 (0)