From 5c9477c932762ef56cfde1860c726d7efc3eced7 Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Thu, 8 Sep 2016 02:53:39 +0200 Subject: [PATCH] decode row run2d to ensure there is no binary prefix included in sdss url. --- astroquery/sdss/core.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/astroquery/sdss/core.py b/astroquery/sdss/core.py index 4793612d34..121acb0cea 100644 --- a/astroquery/sdss/core.py +++ b/astroquery/sdss/core.py @@ -575,11 +575,17 @@ def get_spectra_async(self, coordinates=None, radius=2. * u.arcsec, results = [] for row in matches: linkstr = self.SPECTRA_URL_SUFFIX - # _parse_result returns bytes for instruments, requiring a decode + # _parse_result returns bytes (requiring a decode) for + # - instruments + # - run2d sometimes (#739) + if isinstance(row['run2d'], bytes): + run2d = row['run2d'].decode() + else: + run2d = row['run2d'] link = linkstr.format( base=conf.sas_baseurl, dr=data_release, instrument=row['instrument'].decode().lower(), - run2d=row['run2d'], plate=row['plate'], + run2d=run2d, plate=row['plate'], fiber=row['fiberID'], mjd=row['mjd']) results.append(commons.FileContainer(link,