Package: xapers
Version: 0.7.1-1
Severity: normal
Tags: upstream

Some filenames have multiple consecutive spaces. For example:

'this  filename   is    multiply     spaced.pdf'

Pybtex, like BibTeX, removes multiple consecutive spaces:

'this filename is multiply spaced.pdf'

This means that xapers cannot import a BibTeX file containing paths with multiple consecutive spaces.

I've attached an example error message when attempting to import an actual file (err.txt) as well as a python script that runs a minimal working example.

If the file is imported using "xapers add" instead of "xapers import", the bibtex file in the subdirectory of ~/.xapers/docs/ will contain the wrong path, since the consecutive spaces have been removed.

I've reproduced this bug with the latest git revision:

e4131c21bb8222bea6b896e8efe9571aaef87063

from here:

https://finestructure.net/git/xapers

Besides changing the filename, I have not discovered a workaround.

Sincerely,

Nathaniel Beaver

-- System Information:
Debian Release: 9.4
  APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-debug'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.14.0-0.bpo.3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages xapers depends on:
ii  poppler-utils         0.48.0-2+deb9u2
ii  pybtex                0.20.1-1
ii  python-pkg-resources  33.1.1-1
ii  python-urwid          1.3.1-2+b1
ii  python-xapian         1.4.3-1
pn  python:any            <none>

Versions of packages xapers recommends:
ii  python-pycurl  7.43.0-2
ii  xclip          0.12+svn84-4+b1
ii  xdg-utils      1.1.1-1

xapers suggests no packages.

-- no debconf information
frank_struktur_1975
  Adding file: 
/home/nathaniel/.zotero/zotero/vt5s686l.default/zotero/storage/H3Q2PJGT/Frank 
et al. - 1975 - Die Struktur der Phase Li5Sn2 The Crystal Struct.pdf
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/dist-packages/xapers/__main__.py", line 227, in 
<module>
    cli.importbib(db, bibfile, tags=tags)
  File "/usr/lib/python2.7/dist-packages/xapers/cli.py", line 353, in importbib
    doc.add_file(filepath)
  File "/usr/lib/python2.7/dist-packages/xapers/documents.py", line 274, in 
add_file
    with open(infile, 'r') as f:
IOError: [Errno 2] No such file or directory: 
u'/home/nathaniel/.zotero/zotero/vt5s686l.default/zotero/storage/H3Q2PJGT/Frank 
et al. - 1975 - Die Struktur der Phase Li5Sn2 The Crystal Struct.pdf'
#! /usr/bin/python

import xapers.bibtex

myexample = u"""
@article{myexample,
	file = {this  filename   is    multiply     spaced.pdf:this  filename   is    multiply     spaced.pdf:application/pdf}
}
"""

if __name__ == '__main__':

    original_filename = u'this  filename   is    multiply     spaced.pdf'
    mybib = xapers.bibtex.Bibtex(myexample)
    myent = next(mybib)
    print(original_filename)
    print(myent.get_file())

Reply via email to