Skip to content

Commit 58f808e

Browse files
committed
fix a bug that makes that URLSave always fails
1 parent de264b8 commit 58f808e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

mathics/builtin/files_io/filesystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2274,7 +2274,7 @@ def apply_2(self, url, filename, evaluation, **options):
22742274
url = url.value
22752275
if filename is None:
22762276
result = urlsave_tmp(url, None, **options)
2277-
elif filename.get_head_name() == "String":
2277+
elif isinstance(filename, String):
22782278
filename = filename.value
22792279
result = urlsave_tmp(url, filename, **options)
22802280
else:

mathics/core/streams.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ def urlsave_tmp(url, location=None, **kwargs):
4343
with open(location, "wb") as fp:
4444
fp.write(r.content)
4545
result = fp.name
46+
return result
4647
except Exception:
47-
result = None
48-
return result
48+
return None
49+
return None
4950

5051

5152
def path_search(filename: str) -> Tuple[str, bool]:

0 commit comments

Comments
 (0)