From f62dbf61d22571e115dd8b9aa2739d2e8efba945 Mon Sep 17 00:00:00 2001 From: Matthias Goerner <1239022+unhyperbolic@users.noreply.github.com> Date: Fri, 29 Nov 2024 11:46:07 -0800 Subject: [PATCH] Ptolemy: checking for .magma_out.gz file and uncompressing it. The webhost recently changed something and my configuration to uncompress the files on the fly on the server site no longer works. The plan doesn't allow for uncompressed file. So this is doing in the uncompressing on the client side instead. Haven't updated all the directories yet. But Manifold(m004).ptolemy_variety(2,'all').retrieve_solutions() already works. --- python/ptolemy/ptolemyVariety.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/python/ptolemy/ptolemyVariety.py b/python/ptolemy/ptolemyVariety.py index 1e38d220..40e60c23 100644 --- a/python/ptolemy/ptolemyVariety.py +++ b/python/ptolemy/ptolemyVariety.py @@ -599,7 +599,7 @@ def retrieve_solutions(self, numerical=False, data_url=None, verbose=True): - exts = ['magma_out', 'rur'] + exts = ['magma_out.gz', 'magma_out', 'rur'] if prefer_rur: exts = exts[::-1] @@ -993,8 +993,14 @@ def _retrieve_url(url): if sigalrm_handler: # Not supported under windows signal.signal(signal.SIGALRM, sigalrm_handler) + text = s.read() + + if url.endswith('.gz'): + import gzip + text = gzip.decompress(text) + # Read the text - text = s.read().decode('ascii').replace('\r\n', '\n') + text = text.decode('ascii').replace('\r\n', '\n') if not (url.startswith('http:') or url.startswith('https')): # If this is a normal file, we are done