我正在为Blender写一个插件,以便与Gimp同步,这个脚本应该能够从Gimp中启动,但我不能注册它……为什么?
blender_gimp_sync.py:
# -*- coding: utf-8 -*-
#!/usr/bin/env python
from gimpfu import *
def blender_gimp_sync():
image_dir = "/home/antoni4040/Έγγραφα/Layout.png"
image = gimp.pdb.gimp_file_load(image_dir, image_dir)
gimp.Display(image)
register(
"python_fu_bgsync",
"Blender-Gimp Sync",
"Syncronize Gimp with Blender for texturing",
"Antonis Karvelas",
"Antonis Karvelas",
"2012",
"<Image>/Image/Blender-Gimp Sync",
"*",
[],
[],
blender_gimp_sync
)
main()真的很奇怪。
发布于 2012-10-04 10:42:12
您没有说您得到的是哪个错误--但是既然您发布了源文件,我想我可以猜到它: GIMP expect是系统可执行的插件--并且告诉Posix (包括linux)系统应该用特定的解释器或shell执行文件的是shebang行-在示例中是#!/usr/bin/env python行。
但是,此行必须是文件中的第一行-其中的#!字符应该是文件中的前两个字符。表示字符编码的行- # -*- coding: utf-8 -*-应该在它之后-它必须是文件中的第二行,它们之间没有空行)。
最后,确保将脚本设置为可执行文件,方法是对a+x文件运行"chmod Python“。
与此相关,但不是导致问题的原因,在GIMP中不建议将菜单路径与脚本菜单名称放在一起-正确的方法是,在"date“参数之后传递应该在菜单中显示的名称-- "Sync”-并在调用结束时将菜单路径作为命名参数传递,如:menu="<Image>/Image/Blender-Gimp"
https://stackoverflow.com/questions/12713399
复制相似问题