Open realKarthikNair opened 2 years ago
Did you resolve it?
@probablyArth Nope.
Bumping, having identical issue. Is this module still being supported? OP opened the issue in June.
I don't think it is still being supported
So my workaround is to go into memoize.py and just comment out lines 24 and 27 since the function is basically failing to check for that hashtable (collections doesn't have a hashtable attribute). I won't claim to know what this does because I don't have to time to unravel the entire module, so make sure you test thoroughly, but I'm not seeing any issues so far.
I'm then able to run PyDocX successfully using the Exporter class:
from pydocx import PyDocX
from pydocx.export import PyDocXHTMLExporter
# Pass in a file object
exporter = PyDocXHTMLExporter(open('C:\\Users\\<user>\\Documents\\AOT.docx', 'rb'))
html = exporter.export()
print(html)
Thanks man.
This looks like a python2 to python3 issue.
Where once collections.Hashable
existed now typing.Hashable
has taken its place.
Unfortunately until a new version is packaged and published the manual edit is probably necessary.
https://stackoverflow.com/questions/3460650/asking-is-hashable-about-a-python-value
https://python.readthedocs.io/en/v2.7.2/library/collections.html?highlight=collections#collections.Hashable
https://docs.python.org/3/library/collections.abc.html#collections.abc.Hashable
I'm having the same problem as OP.
$ pydocx --html file-sample_1MB.docx output.html
Traceback (most recent call last):
File "/home/phillip/.local/bin/pydocx", line 8, in
I met the same problem. The environment:
python 3.10.13
pydocx 0.9.10
I fixed it by following: https://github.com/CenterForOpenScience/pydocx/blob/98c6aa626d875278240eabea8f86a914840499b3/pydocx/util/memoize.py#L24
to:
if not isinstance(args, collections.abc.Hashable):
# uncacheable. a list, for instance.
# better to not cache than blow up.
return self.func(*args)
Python 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0] on linux