You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AttributeError: module 'diff_match_patch' has no attribute 'diff' #39
$ pdf-diff journal.pdf journal_v3.pdf > comparison.png
Traceback (most recent call last):
File "/usr/local/bin/pdf-diff", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/pdf_diff/command_line.py", line 497, in main
changes = compute_changes(args.files[0], args.files[1], top_margin=float(args.top_margin), bottom_margin=float(args.bottom_margin))
File "/usr/local/lib/python3.6/dist-packages/pdf_diff/command_line.py", line 17, in compute_changes
diff = perform_diff(docs[0][1], docs[1][1])
File "/usr/local/lib/python3.6/dist-packages/pdf_diff/command_line.py", line 122, in perform_diff
return diff_match_patch.diff(
AttributeError: module 'diff_match_patch' has no attribute 'diff'
I've got the the problem above on a Xubuntu 18.04.3 LTS machine witch python 3.6. pdf-diff version 0.9.1 was installed through pip. I am not sure how to debug it further, or what further information are needed to diagnose the error.
Python 3.6.8 (default, Oct 7 2019, 12:59:55)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import diff_match_patch
>>> dir(diff_match_patch)
['__author__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__packager__', '__path__', '__spec__', '__version__', 'diff_match_patch', 'patch_obj', 'sys']
Hi. Unfortunately I'm not able to spend time on this project these days. I appreciate the bug report but probably won't be able to fix it (at least not until I need this project next).
On January 16, 2020 8:11:51 AM EST, horror-vacui ***@***.***> wrote:
```
$ pdf-diff journal.pdf journal_v3.pdf > comparison.png
Traceback (most recent call last):
File "/usr/local/bin/pdf-diff", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/pdf_diff/command_line.py",
line 497, in main
changes = compute_changes(args.files[0], args.files[1],
top_margin=float(args.top_margin),
bottom_margin=float(args.bottom_margin))
File "/usr/local/lib/python3.6/dist-packages/pdf_diff/command_line.py",
line 17, in compute_changes
diff = perform_diff(docs[0][1], docs[1][1])
File "/usr/local/lib/python3.6/dist-packages/pdf_diff/command_line.py",
line 122, in perform_diff
return diff_match_patch.diff(
AttributeError: module 'diff_match_patch' has no attribute 'diff'
```
```
$ pip3 install diff_match_patch
Requirement already satisfied: diff_match_patch in
/usr/local/lib/python3.6/dist-packages (20181111)
```
I've got the the problem above on a Xubuntu 18.04.3 LTS machine witch
python 3.6. pdf-diff version 0.9.1 was installed through pip. I am not
sure how to debug it further, or what further information are needed to
diagnose the error.
```
Python 3.6.8 (default, Oct 7 2019, 12:59:55)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import diff_match_patch
>>> dir(diff_match_patch)
['__author__', '__builtins__', '__cached__', '__doc__', '__file__',
'__loader__', '__name__', '__package__', '__packager__', '__path__',
'__spec__', '__version__', 'diff_match_patch', 'patch_obj', 'sys']
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#39
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
hi, for windows there isn't anything like pdf-diff we have to install poppler and visual c++ 14.0 requirement, and then it works,
it is pip install diff_match_patch_python
This issue is caused by a name collision issue between diff_match_patch and diff_match_patch_python. This program requires diff_match_patch-python, but diff_match_patch is installed by default on many systems. I uninstalled diff_match_patch using pip uninstall diff_match_patch and it works as intended.
I'm on MacOS using a Conda environment with Python 3.9 installed.
I'm not sure if this is an optimal solution, as diff_match_patch seems to be a frequently used library, but it works for me.
Reacted by hiyyg, Carlos PINZóN, Vetrivel-PS and Tang
Activity
JoshData commentedon Jan 17, 2020
Grandement commentedon Jan 28, 2020
Hi,
I have the same problem. Is it possible that you have a typo in the script?
Maybe it is diff_match_patch.diff_main instead of just diff_match_patch.diff?
SaiSandeepKantareddy commentedon Dec 3, 2020
hi, for windows there isn't anything like pdf-diff we have to install poppler and visual c++ 14.0 requirement, and then it works,
it is pip install diff_match_patch_python
readjfb commentedon Sep 3, 2021
This issue is caused by a name collision issue between diff_match_patch and diff_match_patch_python. This program requires diff_match_patch-python, but diff_match_patch is installed by default on many systems. I uninstalled diff_match_patch using
pip uninstall diff_match_patchand it works as intended.I'm on MacOS using a Conda environment with Python 3.9 installed.
I'm not sure if this is an optimal solution, as diff_match_patch seems to be a frequently used library, but it works for me.
ErqingLi commentedon Oct 21, 2021
It works for me if I change line 122 into
diff_match_patch.diff_match_patch().diff_mainVetrivel-PS commentedon Mar 29, 2022
Use
pip uninstall diff_match_patchand
pip install diff_match_patch_pythonpip install pdf-diffIt works like a charm without any issue. readjfb your suggestions helped a lot in a pdf comparison project.