Closed
Description
I tried importing the built-in supernova model 'hsiao' following the instructions on the SNCosmo website under the "Supernova Models" section. In Python 3, the line
model = sncosmo.Model(source='hsiao')
breaks with the error TypeError: can't use a string pattern on a bytes-like object
. The error comes from this line in builtins.py
:
urls = json.load(f)
which fails because the previous line,
f = urlopen("http://sncosmo.github.io/data/urls.json")
returns raw bytes in Python 3, whereas in Python 2 it returns a string (which is what json.load()
expects).
This error does not occur in either version of Python if the requested SN model has already been downloaded and cached.
Metadata
Metadata
Assignees
Labels
No labels
Activity