dsanson / termpdf.py

A graphical pdf and epub reader that works inside the kitty terminal
MIT License
496 stars 30 forks source link

Install issues / Arch; Py 3.9.2; termpdf 0.1.1 #15

Closed boppy closed 2 years ago

boppy commented 3 years ago

termpdf.py Version:

$ pdf --version
0.1.1
MIT License
Copyright (c) 2019 David Sanson
https://github.com/dsanson/termpdf.py

Install method: git clone + pip install

Python Version:

$ python --version
Python 3.9.2

OS: Arch Linux


First it was complaining about kpsewhich not being available. After installing texlive-bin it is still complaining ;)

The error with having texlive installed is:

Traceback (most recent call last):
  File "/home/boppy/.local/lib/python3.9/site-packages/pybtex/io.py", line 83, in _open
    return _open_existing(opener, filename, mode, locate=kpsewhich, **kwargs)
  File "/home/boppy/.local/lib/python3.9/site-packages/pybtex/io.py", line 57, in _open_existing
    return opener(filename, mode, **kwargs)
FileNotFoundError: [Errno 2] No such file or directory: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/boppy/bin/pdf", line 1863, in <module>
    main()
  File "/home/boppy/bin/pdf", line 1834, in main
    doc.citekey = citekey_from_path(doc.filename)
  File "/home/boppy/bin/pdf", line 1146, in citekey_from_path
    bib = bib_from_field('File',path)
  File "/home/boppy/bin/pdf", line 1132, in bib_from_field
    bib = parse_file(config.BIBTEX,'bibtex')
  File "/home/boppy/.local/lib/python3.9/site-packages/pybtex/database/__init__.py", line 928, in parse_file
    return parser.parse_file(file)
  File "/home/boppy/.local/lib/python3.9/site-packages/pybtex/database/input/__init__.py", line 52, in parse_file
    with open_file(filename, encoding=self.encoding) as f:
  File "/home/boppy/.local/lib/python3.9/site-packages/pybtex/io.py", line 95, in open_unicode
    return _open(io.open, filename, mode, encoding=encoding)
  File "/home/boppy/.local/lib/python3.9/site-packages/pybtex/io.py", line 85, in _open
    raise PybtexError("unable to open %s. %s" % (filename, error.strerror))
pybtex.exceptions.PybtexError: unable to open . No such file or directory
The error without having texlive installed is: ``` Traceback (most recent call last): File "/home/boppy/.local/lib/python3.9/site-packages/pybtex/io.py", line 83, in _open return _open_existing(opener, filename, mode, locate=kpsewhich, **kwargs) File "/home/boppy/.local/lib/python3.9/site-packages/pybtex/io.py", line 54, in _open_existing found = locate(filename) File "/home/boppy/.local/lib/python3.9/site-packages/pybtex/kpathsea.py", line 28, in kpsewhich p = Popen(['kpsewhich', filename], stdout=PIPE, stderr=PIPE) File "/usr/lib/python3.9/subprocess.py", line 951, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'kpsewhich' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/boppy/bin/pdf", line 1863, in main() File "/home/boppy/bin/pdf", line 1834, in main doc.citekey = citekey_from_path(doc.filename) File "/home/boppy/bin/pdf", line 1146, in citekey_from_path bib = bib_from_field('File',path) File "/home/boppy/bin/pdf", line 1132, in bib_from_field bib = parse_file(config.BIBTEX,'bibtex') File "/home/boppy/.local/lib/python3.9/site-packages/pybtex/database/__init__.py", line 928, in parse_file return parser.parse_file(file) File "/home/boppy/.local/lib/python3.9/site-packages/pybtex/database/input/__init__.py", line 52, in parse_file with open_file(filename, encoding=self.encoding) as f: File "/home/boppy/.local/lib/python3.9/site-packages/pybtex/io.py", line 95, in open_unicode return _open(io.open, filename, mode, encoding=encoding) File "/home/boppy/.local/lib/python3.9/site-packages/pybtex/io.py", line 85, in _open raise PybtexError("unable to open %s. %s" % (filename, error.strerror)) pybtex.exceptions.PybtexError: unable to open . No such file or directory ```
Neurognostic commented 3 years ago

I have the same issue, but after installing bibtool (noted as an optional dependency) it would display my pdf successfully.

However, there is now a bibtool warning shown on the console "underneath" where termpdf.py draws and is seen on exit:

*** BibTool WARNING: File  not found.

(notice the double space) Which is similar to the Python error before installing texlive:

...
FileNotFoundError: [Errno 2] No such file or directory: ''
...

Not sure what that's about. What file is not found? Null file?

zos-goatherd commented 3 years ago

I am getting the same error on Ubuntu 20.04

ashishbinu commented 2 years ago

I am using manjaro and had the same issue. But after installing bibtool from aur it shows pdf in terminal. It still gives this error in terminal after closing the pdf using q.

~/Documents                                                                                                                       4s
❯ termpdf.py adt.pdf 
warning: kpathsea: configuration file texmf.cnf not found in these directories: /usr/bin:/usr/bin/share/texmf-local/web2c:/usr/bin/share/texmf-dist/web2c:/usr/bin/share/texmf/web2c:/usr/bin/texmf-local/web2c:/usr/bin/texmf-dist/web2c:/usr/bin/texmf/web2c:/usr:/usr/share/texmf-local/web2c:/usr/share/texmf-dist/web2c:/usr/share/texmf/web2c:/usr/texmf-local/web2c:/usr/texmf-dist/web2c:/usr/texmf/web2c://texmf-local/web2c:/://share/texmf-local/web2c://share/texmf-dist/web2c://share/texmf/web2c://texmf-local/web2c://texmf-dist/web2c://texmf/web2c.

*** BibTool WARNING: File  not found.
the-fermi-paradox commented 2 years ago

Same issue, Debian 11. Running this fixed it for me: apt-get install texlive texlive-latex-extra texlive-latex-recommended

nashidau commented 2 years ago

Same issue on mac os.

Traceback (most recent call last):
  File "/Library/Python/3.8/site-packages/pybtex/io.py", line 83, in _open
    return _open_existing(opener, filename, mode, locate=kpsewhich, **kwargs)
  File "/Library/Python/3.8/site-packages/pybtex/io.py", line 54, in _open_existing
    found = locate(filename)
  File "/Library/Python/3.8/site-packages/pybtex/kpathsea.py", line 28, in kpsewhich
    p = Popen(['kpsewhich', filename], stdout=PIPE, stderr=PIPE)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'kpsewhich'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/termpdf.py", line 1859, in <module>
    main()
  File "/usr/local/bin/termpdf.py", line 1830, in main
    doc.citekey = citekey_from_path(doc.filename)
  File "/usr/local/bin/termpdf.py", line 1142, in citekey_from_path
    bib = bib_from_field('File',path)
  File "/usr/local/bin/termpdf.py", line 1128, in bib_from_field
    bib = parse_file(config.BIBTEX,'bibtex')
  File "/Library/Python/3.8/site-packages/pybtex/database/__init__.py", line 928, in parse_file
    return parser.parse_file(file)
  File "/Library/Python/3.8/site-packages/pybtex/database/input/__init__.py", line 52, in parse_file
    with open_file(filename, encoding=self.encoding) as f:
  File "/Library/Python/3.8/site-packages/pybtex/io.py", line 95, in open_unicode
    return _open(io.open, filename, mode, encoding=encoding)
  File "/Library/Python/3.8/site-packages/pybtex/io.py", line 85, in _open
    raise PybtexError("unable to open %s. %s" % (filename, error.strerror))
pybtex.exceptions.PybtexError: unable to open . No such file or directory
dsanson commented 2 years ago

Apologies for all this! Someone (me) needs to go through and clean up the code. This was the first thing I ever tried to make out python, and it shows...