Fix bug in export.
Not using ui.print_ was causing encoding error.
This commit is contained in:
parent
b71b602a50
commit
0274f2640a
@ -1,18 +1,16 @@
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
|
||||
from .. import repo
|
||||
from ..configs import config
|
||||
from ..uis import get_ui
|
||||
from .. import endecoder
|
||||
|
||||
|
||||
def parser(subparsers):
|
||||
parser = subparsers.add_parser('export',
|
||||
help='export bibliography')
|
||||
parser = subparsers.add_parser('export', help='export bibliography')
|
||||
# parser.add_argument('-f', '--bib-format', default='bibtex',
|
||||
# help='export format')
|
||||
parser.add_argument('citekeys', nargs='*',
|
||||
help='one or several citekeys')
|
||||
parser.add_argument('citekeys', nargs='*', help='one or several citekeys')
|
||||
return parser
|
||||
|
||||
|
||||
@ -27,7 +25,7 @@ def command(args):
|
||||
|
||||
try:
|
||||
papers = [rp.pull_paper(c) for c in args.citekeys]
|
||||
except repo.InvalidReference, v:
|
||||
except repo.InvalidReference as v:
|
||||
ui.error(v)
|
||||
ui.exit(1)
|
||||
|
||||
@ -36,9 +34,6 @@ def command(args):
|
||||
bib = {}
|
||||
for p in papers:
|
||||
bib[p.citekey] = p.bibentry
|
||||
try:
|
||||
exporter = endecoder.EnDecoder()
|
||||
bibdata_raw = exporter.encode_bibdata(bib)
|
||||
print(bibdata_raw, end='')
|
||||
except KeyError:
|
||||
ui.error("Invalid output format: %s." % bib_format)
|
||||
exporter = endecoder.EnDecoder()
|
||||
bibdata_raw = exporter.encode_bibdata(bib)
|
||||
ui.print_(bibdata_raw)
|
||||
|
Loading…
x
Reference in New Issue
Block a user