Pdf2docx: cannot import name 'parse' from 'pdf2docx'

Created on 20 Oct 2020  ·  2Comments  ·  Source: dothinking/pdf2docx

I try to run de example in the README.md and give that error.

from pdf2docx import parse

pdf_file = '09_0370.pdf'
docx_file = 'File.docx'

# convert pdf to docx
parse(pdf_file, docx_file, start=0, end=1)

What's wrong?

question

Most helpful comment

2020-10-20 16_48_51
Yes, the library is installed, I do a pip freeze and it appears in the list, applying the method of you said it works well, but I do not know, it seems to me something little optimal to include the folders in my project, I use window 10 x32 Bits in case it is useful. I have uninstalled and reinstalled it but this time from the setup.py and nothing, it keeps throwing me the same error.

EDIT: Ok, my stupid mistake, I had a file called pdf2docx.py in my project folder and well, logically the from pdf2docx import parse pointed to that file instead of the installed libraries, how stupid.

All 2 comments

Have you installed the library first? After that it should work. Please refer to Installation section in README.md.

If not, say you'd like to use the source code directly, you need to import parse like:

from pdf2docx.main import parse

2020-10-20 16_48_51
Yes, the library is installed, I do a pip freeze and it appears in the list, applying the method of you said it works well, but I do not know, it seems to me something little optimal to include the folders in my project, I use window 10 x32 Bits in case it is useful. I have uninstalled and reinstalled it but this time from the setup.py and nothing, it keeps throwing me the same error.

EDIT: Ok, my stupid mistake, I had a file called pdf2docx.py in my project folder and well, logically the from pdf2docx import parse pointed to that file instead of the installed libraries, how stupid.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Jalkhov picture Jalkhov  ·  5Comments

JoHnTsIm picture JoHnTsIm  ·  7Comments

startxc picture startxc  ·  4Comments

echan00 picture echan00  ·  9Comments

harrylyf picture harrylyf  ·  5Comments