简体   繁体   中英

How can I import a .PYD module in IronPython?

I'm trying to use a python package from IronPython. Everything works fine if I import regular python modules.

But when I try to do the following:

import win32ui

I get:

No module named win32ui

I've hunted through the code in IronPython.Runtime.Importer and there's no mention of .pyd

Anyone know a way around this?

You can check out IronClad which is working to provide this support. It may or may not work w/ your PYD of choice.

A .pyd file is a DLL. So unless IronPython (which is written in .net) can correctly load C DLLs written for CPython, you might be out of luck.


Update

In fact, according to the IronPython FAQ , you are unfortunately unable to import .pyd files:

Q: How do I build and call into PYD libraries?

A: IronPython does not support using PYDs built for CPython since they leverage implementation details of CPython. You can get a similar effect for new "PYD"s you would like to implement by writing them in C# or VB and building a DLL for .NET.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM