ironpython3 icon indicating copy to clipboard operation
ironpython3 copied to clipboard

IronPython.Runtime.Exceptions.ImportException: 'No module named 'xml.etree.ElementTree''

Open ssalmans428 opened this issue 10 months ago • 5 comments

Hi,

I am trying to run python script from C# (.net Framework 4.7 Class Library Project) . I am using Visual studio 2022. I have added IronPython 3.4.1 as reference to my project, IronPython.StdLib 3.4.1 also added.

When there are no import statements inside the script it is running fine, when there is an import statement in my script file its throwing an "No Module Found error" even though the module is found under the lib folder.

This error is not specific to a module its giving me error for all the basic modules like Math module also.

I added the Searchpaths as well mapping to the lib folder, but still getting the error. Can you tell me what needs to be changed here?

Capture6 Capture5 Capture4

Let me know if you require more details......

ssalmans428 avatar Apr 01 '24 06:04 ssalmans428

Why are there { and } in your libs path?

slozier avatar Apr 01 '24 14:04 slozier

Why are there { and } in your libs path?

Hi I modified the syntax now also the error is coming related to Module _sre. I have not used this one in my Script. From where this is popping up?

Can you provide me the correct way to map the libs?

image

ssalmans428 avatar Apr 01 '24 18:04 ssalmans428

_sre is a built-in module and not part of the lib. It sounds like IronPython.Modules.dll is not getting copied to your output folder (same issue as https://github.com/IronLanguages/ironpython3/issues/1778).

slozier avatar Apr 01 '24 19:04 slozier

_sre is a built-in module and not part of the lib. It sounds like IronPython.Modules.dll is not getting copied to your output folder (same issue as #1778).

Hi, I manually place the dll's in output folder but now i am getting the error related to Import requests. 1.Requests module is not available in ironpython? 2.I can see request.py is available under urllib folder are these same? 3.Any workaround for requests module in ip?

image image

ssalmans428 avatar Apr 02 '24 05:04 ssalmans428

The requests module is not part of the standard library. You'll have to find a compatible version (e.g. 2.21.0) and make it (and its dependencies) available in your search paths.

slozier avatar Apr 04 '24 00:04 slozier