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

(Question) AttributeError: 'Document' object has no attribute 'isClosed' #679

Closed
ghost opened this issue Oct 5, 2020 · 3 comments
Closed
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Oct 5, 2020

Operating system: Windows 10
Python version: 3.8.6
Error output:

Traceback (most recent call last):
File "pythonfilename.py", line 145, in
pdf_scan()
File "pythonfilename.py", line 44, in pdf_scan
doc = fitz.open(filename, 'rb')
File "C:\Users(username)\AppData\Local\Programs\Python\Python38\lib\site-packages\fitz\fitz.py", line 3033, in init
raise ValueError("bad type: 'stream'")
ValueError: bad type: 'stream'
Exception ignored in: <function Document.del at 0x000001D89CB8D310>
Traceback (most recent call last):
File "C:\Users(username)\AppData\Local\Programs\Python\Python38\lib\site-packages\fitz\fitz.py", line 4191, in del
self._reset_page_refs()
File "C:\Users(username)\AppData\Local\Programs\Python\Python38\lib\site-packages\fitz\fitz.py", line 4181, in _reset_page_refs
if self.isClosed:
AttributeError: 'Document' object has no attribute 'isClosed'

Please help me.

@ghost ghost added the question label Oct 5, 2020
@ghost ghost assigned JorjMcKie Oct 5, 2020
@JorjMcKie
Copy link
Collaborator

doc = fitz.open(filename, 'rb')

This is not one of the possible fitz.open() formats! See documentation.
So the document was not created and consequently cannot have several of its attributes.

@JorjMcKie
Copy link
Collaborator

JorjMcKie commented Oct 7, 2020

Any more help required?
Just omit "rb" - and you should be fine.

@JorjMcKie
Copy link
Collaborator

closed for lack of reaction

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

No branches or pull requests

1 participant