-1

I'm trying to convert an XML to JSON using 'xmltodict'

My code:

import xmltodict
import json
with open('ELT.xml') as inFh:
    with open('ELT.json','w') as outFh:
        json.dump(xmltodict.parse(inFh.read()), outFh)

The error:

 import xmltodict
ModuleNotFoundError: No module named 'xmltodict'

I tried: pip install xmltodict but got this result:

C:\Users\user>pip install xmltodict
Requirement already satisfied: xmltodict in c:\users\user\anaconda3\lib\site-packages (0.12.0)
Kyle Marvin
  • 29
  • 1
  • 3

1 Answers1

-1

This is sometimes caused by pip version. Please upgrade pip to latest version and then uninstall and reinstall the xmltodict package.

Prateek
  • 189
  • 1
  • 3
  • 13
  • I uninstalled and re-installed pip. Then I tried reinstall xmltodict, but I get the same error. I checked the version history of xmltodict and it's the most up-to-date version. – Kyle Marvin May 06 '20 at 18:00
  • In your virtual environment you will find python.exe and pip.exe try to run pip from the virtual environment and install it and see if it fixes – Prateek May 07 '20 at 16:06