Last active
January 25, 2018 22:29
-
-
Save drdavella/18aae94198383e6ef4846c5dc7d1390f to your computer and use it in GitHub Desktop.
Simple reproducer for transient ASDF bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import asdf | |
from astropy import units as u | |
from astropy.coordinates.representation import SphericalRepresentation | |
tree = {'coord': SphericalRepresentation(10*u.deg, 10*u.deg, 1*u.m)} | |
print('distance:', tree['coord'].distance) | |
with asdf.AsdfFile(tree=tree) as ff: | |
ff.write_to("test.asdf") | |
with open('test.asdf', 'rb') as ff: | |
data = ff.read() | |
try: | |
print(data.decode('ascii')) | |
except UnicodeDecodeError: | |
index = data.find(b'\xd3BLK') | |
print(data[:index].decode('ascii')) | |
print(data[index:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment