Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot import name 'parse' from 'pdf2docx' #55

Closed
Jalkhov opened this issue Oct 20, 2020 · 4 comments
Closed

cannot import name 'parse' from 'pdf2docx' #55

Jalkhov opened this issue Oct 20, 2020 · 4 comments
Assignees
Labels
question discussion

Comments

@Jalkhov
Copy link

Jalkhov commented Oct 20, 2020

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?

@dothinking
Copy link
Collaborator

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

@dothinking dothinking self-assigned this Oct 20, 2020
@dothinking dothinking added the question discussion label Oct 20, 2020
@Jalkhov
Copy link
Author

Jalkhov commented Oct 20, 2020

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.

@Jalkhov Jalkhov closed this as completed Oct 21, 2020
@jaidee2020
Copy link

from pdf2docx.main import parse ?? does do the trick :( :(
still error cannot import name 'parse' from 'pdf2docx'

@dothinking
Copy link
Collaborator

See Jalkhov's comment above, check whether your have pdf2docx.py, which is conflict with the library name pdf2docx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question discussion
Projects
None yet
Development

No branches or pull requests

3 participants