-2

我真的几乎放弃了尝试为 Blender 2.68 创建一个导入导出模块插件,这似乎是一个无法克服的 python 问题(Blender 使用 python 3.3)。我在 stackoverflow 中看到很多关于这个主题的问题,但没有一个能回答我的问题。我的脚本的一部分:

if "bpy" in locals():
    import imp
    imp.reload(xplane_ui)
    print ("xplane_ui reloaded.")
    imp.reload(explane_import)
    print ("All modules reloaded.")

else:
    import bpy
    from io_explane import xplane_ui
    print ("xplane_ui imported.")
    from io_explane import explane_import #this is line 47
    print ("All modules imported")

我添加了额外的打印行以查看发生了什么。这是跟踪结果:

Read new prefs: C:\Users\BT\AppData\Roaming\Blender Foundation\Blender\2.68\config\userpref.blend
found bundled python: C:\blender-2.68a-windows32\2.68\python
xplane_ui imported
All modules imported
xplane_ui imported.
Traceback (most recent call last):
  File "C:\blender-2.68a-windows32\2.68\scripts\modules\addon_utils.py", line 294, in enable
    mod = __import__(module_name)
  File "C:\blender-2.68a-windows32\2.68\scripts\addons\io_explane\__init__.py", line 47, in <module>
    from io_explane import explane_import
ImportError: cannot import name explane_import

这太奇怪了。我假设 python 从上到下进展,但它如何通过第 46、47 和 48 行,然后在第 47 行更改决定,并在明显完成后宣布它无法做到?要么 python 是一种无用的编程语言,要么搅拌机坏了,要么两者兼而有之。无论哪种方式,错误捕获例程都非常无用。

4

1 回答 1

1

我不知道 Blender,但你应该导入xplane_import吗?

于 2013-10-14T08:57:03.740 回答