Error importing the library pybtex

Issue #117 invalid
Former user created an issue

I'm using Python 3.6.5 with Fedora 28.

I installed your library with:

# python3 -m pip install  --user  pybtex

An extract of my code:

import pybtex.database

# ...

    def loadBib(self):
        filename = os.path.join(self.cwd, 'MatPhys.bib')
        self.biblio = pybtex.database.parse_file(filename, bib_format='bibtex')

# ...

Here the error:

$ ./zbib.py check /home/tc/e/Books/Maths
Traceback (most recent call last):
  File "./zbib.py", line 11, in <module>
    import pybtex.database
  File "/home/tc/.local/lib/python3.6/site-packages/pybtex/database/__init__.py", line 26, in <module>
    from pybtex.plugin import find_plugin
  File "/home/tc/.local/lib/python3.6/site-packages/pybtex/plugin/__init__.py", line 25, in <module>
    import pkg_resources
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 26, in <module>
    import zipfile
  File "/usr/lib64/python3.6/zipfile.py", line 84, in <module>
    sizeEndCentDir = struct.calcsize(structEndArchive)
AttributeError: module 'struct' has no attribute 'calcsize'

Comments (2)

  1. Andrey Golovizin
    File "/usr/lib64/python3.6/zipfile.py", line 84, in <module>
      sizeEndCentDir = struct.calcsize(structEndArchive)
    AttributeError: module 'struct' has no attribute 'calcsize'
    

    Most likely this is caused by something like a struct.py file in the current directory or somewhere on PYTHONPATH. Does not look like a bug in Pybtex itself.

  2. Log in to comment