Code Monkey home page Code Monkey logo

xapers's People

Contributors

dkg avatar felgru avatar jrollins avatar klgunst avatar nicolassmith avatar np avatar pazz avatar rlaboiss avatar wpettersson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

zenny klgunst ddkn

xapers's Issues

import fails if pdf not found

I hope It's OK to post bugs here.
I am trying to get a reasonable xapers environment set up once again and there are a few pitfalls that I'm running into. One is a crash due to unavailable files. My bibfile contains an entry with:

File                     = {HT2012.pdf:papers/HT2012.pdf:PDF}

But the file is not available (the entry was copied from an old folder).
Now xapers import publications.bib dies on me halfway through the file

...
HT2012
  Adding file: papers/HT2012.pdf
Traceback (most recent call last):
  File "/usr/bin/xapers", line 11, in <module>
    load_entry_point('xapers==0.8.2', 'console_scripts', 'xapers')()
  File "/usr/lib/python3/dist-packages/xapers/__main__.py", line 221, in main
    cli.importbib(db, bibfile, tags=tags)
  File "/usr/lib/python3/dist-packages/xapers/cli.py", line 350, in importbib
    doc.add_file(filepath)
  File "/usr/lib/python3/dist-packages/xapers/documents.py", line 263, in add_file
    with open(infile, 'br') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'papers/HT2012.pdf'

exception on add: TypeError: 'tuple' object is not callable

servo:~ 0$ xapers add --source=arxiv:1901.00869 --file
Retrieving bibtex... done.
Retrieving file... Traceback (most recent call last):
  File "/usr/bin/xapers", line 11, in <module>
    load_entry_point('xapers==0.8.2', 'console_scripts', 'xapers')()
  File "/usr/lib/python3/dist-packages/xapers/__main__.py", line 188, in main
    docid = cli.add(db, query, infile=infile, sid=sid, tags=tags, prompt=prompt)
  File "/usr/lib/python3/dist-packages/xapers/cli.py", line 233, in add
    file_name, file_data = source.fetch_file()
  File "/usr/lib/python3/dist-packages/xapers/source.py", line 153, in fetch_file
    return super(SourceItem, self).fetch_file(self.id)
  File "/usr/lib/python3/dist-packages/xapers/source.py", line 113, in fetch_file
    return func(id)
TypeError: 'tuple' object is not callable
servo:~ 1$ 

Xaper concept/usage scenarios (was: Immediate exception on simple attempt to add a file)

Running 7471e67773b3939852221c5628da63bd32522b5d from https://gitlab.com/jrollins/xapers:

$ python3 -m xapers add -f 1960\ Recursive\ Programming\ -\ Dijkstra.pdf -i
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/mnt/hdd/projects-3rdparty/Tagging/xapers/xapers/__main__.py", line 1009, in <module>
    main()
  File "/mnt/hdd/projects-3rdparty/Tagging/xapers/xapers/__main__.py", line 1005, in main
    args.func(parser, args)
  File "/mnt/hdd/projects-3rdparty/Tagging/xapers/xapers/__main__.py", line 249, in cmd_add
    args.tags = args.tags.split(',')
AttributeError: 'NoneType' object has no attribute 'split'

installation on debian testing?

I'm, trying to install this package from the master branch (github) on a current debian testing.
There seems to be an issue with the xapian dependency (python3-xapian) which is installed.

$  python3 ./setup.py install --user
...
Installing xapers script to /home/pazz/.local/bin

Installed /home/pazz/.local/lib/python3.6/site-packages/xapers-0.8-py3.6.egg
Processing dependencies for xapers==0.8
Searching for xapian
Reading https://pypi.python.org/simple/xapian/
Couldn't find index page for 'xapian' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or working download links found for xapian
error: Could not find suitable distribution for Requirement.parse('xapian')

I have installed the dependencies according to the README. In particular:

$ python3
Python 3.6.4+ (default, Feb 12 2018, 08:25:03) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xapian
>>> xapian
<module 'xapian' from '/usr/lib/python3/dist-packages/xapian/__init__.py'>

But:

$ xapers
Traceback (most recent call last):
  File "/home/pazz/.local/bin/xapers", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3195, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3179, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3208, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 681, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 999, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 885, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'xapian' distribution was not found and is required by xapers

any ideas?

Project discoverability

I already mentioned (#3 (comment)) that I managed to miss xapers up to developing my own tool for papers collection categorization.

Worse, I now spent literally an hour trying to re-discover this project, forgetting its name. I remember that I definitely starred it, and I still couldn't find it in my stars (granted, I have thousands of projects there). I used keywords "papers", "document", and finally "manager", and managed to miss it even with the latter, because xapers has "management" in its description instead. But lack of "papers" or "documents" in description is really hard to explain for a project names "xapers" (which of course would never match "papers" in any search engine).

Please kindly do something about this.

Userstory: Get DOI (or other external public ID) of my local document

As a keeper of a local personal collection (read: minimal, universally useful metadata, like only the titles of documents), sometimes I may want to share a reference to a particular document with the world. I'd like to use more formal document identifier than just a title. So, I'd need a way to look up DOI, arXiv id, or similar identifier for a doc, as well as URL form of that id, which other people can visit.

import fails

In some of my bibtex files I use string variables for journal/conference names, in order to later decide between the full name or the abbreviation (using different bibfiles defining those strings). Here is an example entry:

@Article{	  HT2017,
  title		= "Trace inclusion for one-counter nets revisited ",
  journal	= tcs,
  volume	= "11174",
  year		= "2017",
  issn		= "0304-3975",
  doi		= "https://doi.org/10.1016/j.tcs.2017.05.009",
  author	= "Piotr Hofman and Patrick Totzke",
  keywords	= {mine,OCN}
}

A separate file defines the string "tcs":

@string{tcs     = "Theoretical Computer Science"}

Importing this (no matter if I pass both files or just the one with the bibtex entry) gives:

xapers import refs.bib 
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 288, in substitute_macro
    return self.macros[name]
  File "/usr/lib/python3/dist-packages/pybtex/utils.py", line 154, in __getitem__
    return self._dict[key.lower()]
KeyError: 'tcs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/xapers/bibtex.py", line 60, in __init__
    bibdata = parser.parse_file(bibtex)
  File "/usr/lib/python3/dist-packages/pybtex/database/input/__init__.py", line 51, in parse_file
    self.parse_stream(f)
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 385, in parse_stream
    return self.parse_string(text)
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 372, in parse_string
    for entry in entry_iterator:
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 185, in parse_bibliography
    self.handle_error(error)
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 358, in handle_error
    report_error(error)
  File "/usr/lib/python3/dist-packages/pybtex/errors.py", line 77, in report_error
    raise exception
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 183, in parse_bibliography
    yield tuple(self.parse_command())
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 216, in parse_command
    self.handle_error(error)
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 358, in handle_error
    report_error(error)
  File "/usr/lib/python3/dist-packages/pybtex/errors.py", line 77, in report_error
    raise exception
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 213, in parse_command
    parse_body(body_end)
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 232, in parse_entry_body
    self.parse_entry_fields()
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 240, in parse_entry_fields
    self.parse_field()
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 253, in parse_field
    self.parse_value()
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 264, in parse_value
    value_parts.append(self.parse_value_part())
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 280, in parse_value_part
    value_part = self.substitute_macro(token.value)
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 291, in substitute_macro
    self.handle_error(UndefinedMacro(name, self))
  File "/usr/lib/python3/dist-packages/pybtex/database/input/bibtex.py", line 358, in handle_error
    report_error(error)
  File "/usr/lib/python3/dist-packages/pybtex/errors.py", line 77, in report_error
    raise exception
pybtex.database.input.bibtex.UndefinedMacro: undefined string in line 4: tcs

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/xapers", line 11, in <module>
    load_entry_point('xapers==0.8.2', 'console_scripts', 'xapers')()
  File "/usr/lib/python3/dist-packages/xapers/__main__.py", line 221, in main
    cli.importbib(db, bibfile, tags=tags)
  File "/usr/lib/python3/dist-packages/xapers/cli.py", line 319, in importbib
    for entry in sorted(Bibtex(bibfile), key=lambda entry: entry.key):
  File "/usr/lib/python3/dist-packages/xapers/bibtex.py", line 61, in __init__
    except TokenRequired as e:
NameError: name 'TokenRequired' is not defined

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.