Import librairy like JSON or XML for python, with IronPython on C# App

1

I am trying to execute a Python Script on a C# Application. So I choose Iron Python, I have managed to execute basic code.

But while using libraries like xml or json. I cannot import and use them. I've tried a lot,but nothing works out.

The main thing which I tried was to copy the xml librairy in my C# project folder, and then import it using the following code:

import clr
clr.AddReferenceToFileAndPath("..\\ElementTree.py")
import ElementTree as ET
clr.AddReferenceToFileAndPath("..json\\__init__.py")
import json

But i get this error :

System.BadImageFormatException: 'The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)'

Can someone provide me a with a good solution?

If you need more details, please comment the question.

Thanks in advance

c#
python
xml
wpf
ironpython
asked on Stack Overflow Apr 26, 2018 by Axel • edited Apr 26, 2018 by cezar

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0