开发者

How do I do import hooks in IronPython/Silverlight?

I'm extending TryPython to (along with various other things) allow users to save a file and subsequently import that file. TryPython overloads the built in file operations, so I need to know what parts of import need to hooked into in order for import to use the overloaded file operations.

Rea开发者_运维问答lly, a basic overview of IronPython's import when used in Silverlight would be extremely helpful. I don't need a complete working solution (although I won't stop you from writing one! :). I'm a Python newbie, and I really have no idea where to even begin.

Thanks!


IronPython's import basically works as usual but the file system is abstracted away in Silverlight. This is done by the DLR hosting API's PlatformAdaptionLayer. The end result is that all requests for files to be imported go to the XAP file rather than going to the file system.

I would suggest using one of the various ways you can replace importing functionality. You could either redefine import or better yet use the importer hooks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜