diff --git a/src/sage/databases/findstat.py b/src/sage/databases/findstat.py index 1285569805e..0822a92c168 100644 --- a/src/sage/databases/findstat.py +++ b/src/sage/databases/findstat.py @@ -213,6 +213,7 @@ def mapping(sigma): from ast import literal_eval from copy import deepcopy +from pathlib import Path import re import webbrowser import tempfile @@ -491,8 +492,9 @@ def _submit(args, url): ....: "CurrentEmail": ""} sage: _submit(args, url) # optional -- webbrowser """ - f = tempfile.NamedTemporaryFile(mode='w', suffix='.html', delete=False) + f = tempfile.NamedTemporaryFile(mode='w', suffix='.html', encoding='utf-8', delete=False) verbose("Created temporary file %s" % f.name, caller_name='FindStat') + f.write('\n\n\n') f.write(FINDSTAT_POST_HEADER) f.write(url) for key, value in args.items(): @@ -506,7 +508,7 @@ def _submit(args, url): f.write(FINDSTAT_FORM_FOOTER) f.close() verbose("Opening file with webbrowser", caller_name='FindStat') - webbrowser.open(f.name) + webbrowser.open(Path(f.name).as_uri()) def _data_to_str(data, domain, codomain=None):