From f311de7043de58d4975fa09c3676106da787036b Mon Sep 17 00:00:00 2001 From: Phyks Date: Sun, 3 Aug 2014 21:52:01 +0200 Subject: [PATCH] Fix --- bmc.py | 14 +++++++------- libbmc/fetcher.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bmc.py b/bmc.py index 297f46e..1935632 100755 --- a/bmc.py +++ b/bmc.py @@ -27,7 +27,7 @@ def checkBibtex(filename, bibtex_string): bibtex = BibTexParser(bibtex_string) bibtex = bibtex.get_entry_dict() try: - bibtex = bibtex[bibtex.keys()[0]] + bibtex = bibtex[list(bibtex.keys())[0]] # Check entries are correct assert bibtex['title'] if bibtex['type'] == 'article': @@ -58,7 +58,7 @@ def checkBibtex(filename, bibtex_string): bibtex = bibtex.get_entry_dict() try: - bibtex = bibtex[bibtex.keys()[0]] + bibtex = bibtex[list(bibtex.keys())[0]] except KeyError: tools.warning("Invalid bibtex entry") bibtex_string = '' @@ -176,7 +176,7 @@ def addFile(src, filetype, manual, autoconfirm, tag): bibtex = BibTexParser(bibtex) bibtex = bibtex.get_entry_dict() if len(bibtex) > 0: - bibtex_name = bibtex.keys()[0] + bibtex_name = list(bibtex.keys()[0] bibtex = bibtex[bibtex_name] bibtex_string = tools.parsed2Bibtex(bibtex) else: @@ -310,7 +310,7 @@ def openFile(ident): tools.warning("Unable to open index file.") return False - if ident not in bibtex.keys(): + if ident not in list(bibtex.keys()): return False else: subprocess.Popen(['xdg-open', bibtex[ident]['file']]) @@ -337,7 +337,7 @@ def resync(): if filename == '': break else: - if 'doi' in entry.keys(): + if 'doi' in list(entry.keys()): doi = fetcher.findDOI(filename) if doi is not False and doi != entry['doi']: loop = tools.rawInput("Found DOI does not " + @@ -345,7 +345,7 @@ def resync(): "DOI, continue anyway " + "? [y/N]") loop = (loop.lower() != 'y') - if 'Eprint' in entry.keys(): + if 'Eprint' in list(entry.keys()): arxiv = fetcher.findArXivId(filename) if arxiv is not False and arxiv != entry['Eprint']: loop = tools.rawInput("Found arXiv id does " + @@ -353,7 +353,7 @@ def resync(): "entry arxiv id, " + "continue anyway ? [y/N]") loop = (loop.lower() != 'y') - if 'isbn' in entry.keys(): + if 'isbn' in list(entry.keys()): isbn = fetcher.findISBN(filename) if isbn is not False and isbn != entry['isbn']: loop = tools.rawInput("Found ISBN does not " + diff --git a/libbmc/fetcher.py b/libbmc/fetcher.py index 3a26d74..51e39f6 100644 --- a/libbmc/fetcher.py +++ b/libbmc/fetcher.py @@ -247,7 +247,7 @@ def doi2Bib(doi): try: if dict(r.info())['Content-Type'] == 'application/x-bibtex': - return r.read() + return r.read().decode('utf-8') else: return '' except KeyError: