我知道,这是一个非常琐碎的问题,但我还没有找到任何例子,所以我现在很困惑。你知道吗
我有一个非常简单的Haxe对象。这是文件Thing.hx
的内容:
@Persistent
class Thing {
@Property
public var thingName: String;
}
我可以编译它:
haxe Thing.hx -python Thing.py
结果很神奇,Thing.py
的内容是:
class Thing:
pass
Thing.__meta__ = _hx_AnonObject({'obj': _hx_AnonObject({'Persistent': None}), 'fields': _hx_AnonObject({'thingName': _hx_AnonObject({'Property': None})})})
我的DoTheThing.py
Python程序想要使用这个:
import Thing
但是它在import
语句中失败了:
NameError: name '_hx_AnonObject' is not defined
另外,在我的实际项目中,我有一个更复杂的Haxe类,当我从Python中包含它时,会出现以下错误:
AttributeError: type object 'python_Boot' has no attribute 'keywords'
它们应该包括哪些Python模块?我怎样才能知道,我的Haxe类应该包含哪些模块?你知道吗
最后,我发现需要添加一些
haxe
编译器选项来包含缺少的方法。你知道吗首先我需要安装
nape
:然后编译:
(来源:How do I convert these Haxe source files to Python?)
相关问题 更多 >
编程相关推荐