Skip to content

Commit

Permalink
Ptolemy: checking for .magma_out.gz file and uncompressing it. The we…
Browse files Browse the repository at this point in the history
…bhost 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.
  • Loading branch information
unhyperbolic committed Nov 29, 2024
1 parent f638ed3 commit f62dbf6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions python/ptolemy/ptolemyVariety.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f62dbf6

Please sign in to comment.