我最近从2.8更新到了2.10 GIMP,似乎导入自定义(相对)*。py文件的所有插件都不再起作用。我剖析了代码,它不是“ path_tools.py”文件的内容,这只是尝试导入自定义模块的行为(即使它是一个空文件,它仍然无法使用)。如果没有这一行代码,它会很好地显示在GIMP中:
from path_tools import *
插件和path_tools.py都在同一个文件夹中
\ AppData \ Roaming \ GIMP \ 2.10 \ plugins
我尝试通过添加句点来使用显式相对
from .path_tools import *
from ..path_tools import *
from ...path_tools import *
etc.
我尝试通过在文件底部添加空GIMP效果将文件转换为插件,以查看GIMP是否只是以某种方式忽略了我的文件
def path_tools(img, drw):
return
register(
"python-fu-path-tools",
"Path Tools",
"",
[...]
并在命令提示符下打开GIMP
"c:\program files\gimp 2\bin\gimp-2.10" --verbose --console-messages
对于每个不会加载的插件,它只是给了我很多信息:
Querying plug-in: 'C:\Users\ \AppData\Roaming\GIMP\2.10\plug-ins\path_tools.py'
c:\program files\gimp 2\bin\gimp-2.10: LibGimpBase-WARNING: gimp-2.10: gimp_wire_read(): error
但是这些似乎是警告,尤其是由于另一个我无法加载的插件存在此实际错误,出于类似的原因,我猜测:
GIMP-Error: Unable to run plug-in "export-ALL.py"
与顶部的这些警告相关吗?
Parsing 'c:\program files\gimp 2\lib\gimp\2.0\interpreters\pygimp.interp'
GIMP-Warning: Bad interpreter referenced in interpreter file c:\program files\gimp 2\lib\gimp\2.0\interpreters\pygimp.interp: python
GIMP-Warning: Bad binary format string in interpreter file c:\program files\gimp 2\lib\gimp\2.0\interpreters\pygimp.interp
我只是不知道发生了什么或该怎么做。有没有我可以放置文件的目录,插件可以看到该目录?因为它确实可以导入常规模块,例如“ sys”,“ os”。
(很抱歉,如果这是一个非常愚蠢的问题,我只将Python用于GIMP插件。)
似乎与Gimp 2.10一起嵌入的Python解释/
器用作路径分隔符,而Gimp 2.10\
在Windows上使用。
这个问题在这里讨论。
创建一个C:\Program Files\GIMP 2\32\lib\python2.7\sitecustomize.py
具有以下内容的文件似乎可以解决此问题。
import sys
class Issue1542:
def __del__ (self):
if len (sys.argv[0]):
from os.path import dirname
sys.path[0:0] = [dirname (sys.argv[0])]
sys.argv = Issue1542 ()
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句