Python Forum
ImportError: cannot import name 'DEFUSEDXML' from 'openpyxl' - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: ImportError: cannot import name 'DEFUSEDXML' from 'openpyxl' (/thread-17002.html)



ImportError: cannot import name 'DEFUSEDXML' from 'openpyxl' - kaninaba94 - Mar-24-2019

Hello dear friends,

I am trying to read in an Excel file with openpyxl.

But it always gives me this stacktrace:

C:\Users\kanin\venv\Python3.7\Scripts\python.exe C:/Users/kanin/IdeaProjects/PythonPrograms/hallo3/hallo3.py
Traceback (most recent call last):
File "C:/Users/kanin/IdeaProjects/PythonPrograms/hallo3/hallo3.py", line 2, in <module>
import openpyxl
File "C:\Users\kanin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl-2.6.1-py3.7.egg\openpyxl\__init__.py", line 5, in <module>
File "C:\Users\kanin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl-2.6.1-py3.7.egg\openpyxl\workbook\__init__.py", line 5, in <module>
File "C:\Users\kanin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl-2.6.1-py3.7.egg\openpyxl\workbook\workbook.py", line 8, in <module>
File "C:\Users\kanin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl-2.6.1-py3.7.egg\openpyxl\worksheet\worksheet.py", line 30, in <module>
File "C:\Users\kanin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl-2.6.1-py3.7.egg\openpyxl\cell\__init__.py", line 4, in <module>
File "C:\Users\kanin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl-2.6.1-py3.7.egg\openpyxl\cell\cell.py", line 46, in <module>
File "C:\Users\kanin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl-2.6.1-py3.7.egg\openpyxl\utils\inference.py", line 10, in <module>
File "C:\Users\kanin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl-2.6.1-py3.7.egg\openpyxl\styles\__init__.py", line 5, in <module>
File "C:\Users\kanin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl-2.6.1-py3.7.egg\openpyxl\styles\alignment.py", line 6, in <module>
File "C:\Users\kanin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl-2.6.1-py3.7.egg\openpyxl\descriptors\__init__.py", line 5, in <module>
File "C:\Users\kanin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl-2.6.1-py3.7.egg\openpyxl\descriptors\sequence.py", line 5, in <module>
File "C:\Users\kanin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl-2.6.1-py3.7.egg\openpyxl\xml\functions.py", line 14, in <module>
ImportError: cannot import name 'DEFUSEDXML' from 'openpyxl' (C:\Users\kanin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl-2.6.1-py3.7.egg\openpyxl\__init__.py)

Process finished with exit code 1


Can anybody tell me how to solve this problem? Because I have installed defusedxml..

Cheers, Kaspar


RE: ImportError: cannot import name 'DEFUSEDXML' from 'openpyxl' - kaninaba94 - Mar-24-2019

never mind, I just uninstalled and reinstalled openpyxl and now it works! Don't know how to delete this post.. Cheers