Skip to content

Comments

Fixing decodegraphics.py import error#215

Open
Lucas-C wants to merge 1 commit intopmaupin:masterfrom
Lucas-C:fix-decodegraphics-import-error
Open

Fixing decodegraphics.py import error#215
Lucas-C wants to merge 1 commit intopmaupin:masterfrom
Lucas-C:fix-decodegraphics-import-error

Conversation

@Lucas-C
Copy link

@Lucas-C Lucas-C commented Jan 13, 2021

Given this code:

import os, pdfrw, sys
sys.path.append(os.path.join(os.path.dirname(pdfrw.__file__), '../examples'))
from rl2.decodegraphics import parsepage

This fix avoids the following error with Python 3.7:

Traceback (most recent call last):
  File "./extract_table.py", line 3, in <module>
    from rl2.decodegraphics import parsepage
  File "/opt/pdfrw/pdfrw/../examples/rl2/decodegraphics.py", line 377, in <module>
    class _ParseClass(object):
  File "/opt/pdfrw/pdfrw/../examples/rl2/decodegraphics.py", line 378, in _ParseClass
    dispatch = findparsefuncs()
  File "/opt/pdfrw/pdfrw/../examples/rl2/decodegraphics.py", line 362, in findparsefuncs
    for key, func in globals().items():
RuntimeError: dictionary changed size during iteration

@Lucas-C
Copy link
Author

Lucas-C commented Apr 1, 2021

This PR has been merged in @sarnold fork: https://github.com/sarnold/pdfrw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant