From 4a82a39e0812e673c69e6a3fea4ef32c3b2915ce Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Mon, 23 Dec 2024 20:33:57 +0700 Subject: [PATCH] Fix findstat._submit --- src/sage/databases/findstat.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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):