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

Docx to DMU Fails in Pro 3.3 #111

Open
dmirandaUSGS opened this issue Jun 25, 2024 · 3 comments
Open

Docx to DMU Fails in Pro 3.3 #111

dmirandaUSGS opened this issue Jun 25, 2024 · 3 comments

Comments

@dmirandaUSGS
Copy link
Contributor

I am using the latest version of Docx to DMU, GeMS_DocxToDMU.py, version of 5/8/24. The tool works in Pro 3.2.x, but fails in 3.3. I get the following message:

  File "C:\ArcGIS\0_ToolBoxes\gems-tools-pro\Scripts\GeMS_DocxToDMU.py", line 33, in <module>
    import docx
  File "C:\ArcGIS\0_ToolBoxes\gems-tools-pro\Scripts\docx\__init__.py", line 14, in <module>
    from docx.parts.document import DocumentPart
  File "C:\ArcGIS\0_ToolBoxes\gems-tools-pro\Scripts\docx\parts\document.py", line 7, in <module>
    from docx.document import Document
  File "C:\ArcGIS\0_ToolBoxes\gems-tools-pro\Scripts\docx\document.py", line 10, in <module>
    from docx.section import Section, Sections
  File "C:\ArcGIS\0_ToolBoxes\gems-tools-pro\Scripts\docx\section.py", line 7, in <module>
    from collections import Sequence
ImportError: cannot import name 'Sequence' from 'collections' (C:\Users\dmiranda\AppData\Local\ESRI\conda\envs\arcgispro-py3-mkdocs\Lib\collections\__init__.py)

I was able to get the tool to work by opening section.py and changing the import statement on line 7 to from collections.abc import Sequence. It seems like Sequence was moved from Collections to Collections.abc across the version of Python Pro 3.3 is now using.

The tool appears to work, and I get a DMU table that looks correct, but I am not sure if this is all that needs to be adjusted.

@ethoms-usgs
Copy link
Collaborator

Dan,
For those of us who have not updated Pro yet, and may not for a while, could you add a try block and see if that works?

try:
    from collections import Sequence
except:
    from collections.abc import Sequence

If that works for you, I will make the edit on my end and push it out.

@dmirandaUSGS
Copy link
Contributor Author

The try-except block as written works in Pro 3.3.

@ethoms-usgs
Copy link
Collaborator

Excellent! Thank you. I will put it in the next release.

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

No branches or pull requests

2 participants