hay / dataknead

Effortless conversion between data formats like JSON, XML and CSV

Home Page:https://hay.github.io/dataknead/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot find loader for xml

japborst opened this issue · comments

Performing a simple xml to csv conversion results in error that the xml loader cannot be found.

In [1]: from dataknead import Knead

In [2]: Knead('cd_catalog.xml').write('cd_catalog.csv')
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-2-90e8ad4393dd> in <module>
----> 1 Knead('cd_catalog.xml').write('cd_catalog.csv')

c:\users\japbo\appdata\local\programs\python\python37-32\lib\site-packages\dataknead\knead.py in __init__(self, inp, parse_as, read_as, is_data, **kwargs)
     25                 read_as = Path(inp).suffix[1:]
     26
---> 27             loader = self._get_loader(read_as)
     28
     29             with open(inp) as f:

c:\users\japbo\appdata\local\programs\python\python37-32\lib\site-packages\dataknead\knead.py in _get_loader(self, extension)
     41                 return loader
     42
---> 43         raise Exception("Could not find loader for type '%s'" % extension)
     44
     45     def apply(self, fn):

Exception: Could not find loader for type 'xml'

dataknead 0.2.0 didn't include the XML loader by default, but i just released 0.3.0 which does! So just update your version (pip install -U dataknead) and you'll be fine.

Thanks @hay 👍