大量编辑了一些新信息(和悬赏)
我试图在python中为gimp创建一个插件。(在windows上) 这个页面http://gimpbook.com/scripting/notes.html建议从shell运行它,或者查看~/.xsession错误
都没用。 我可以从命令shell运行它,就像
gimp-2.8.exe -c --verbose ## (as suggested by http://gimpchat.com/viewtopic.php?f=9&t=751 )
这会导致输出来自“pdb.gimp_消息(……)”去终点站。在
但是!!!这只在一切按预期运行的情况下有效,我在崩溃时没有得到任何输出。在
我试过打印报表,但没用。在
另一个人也有类似的问题,但讨论偏离了方向。 Plugins usually don't work, how do I debug?
在某些地方,我看到了在pythonfu控制台中运行它的建议。在
这让我一无所获。我需要注释掉import gimpfu,因为它会引起错误,而且我不能让gtk工作。在
我目前的问题是,即使插件注册并显示在菜单上,当出现一些错误并且它的行为不符合预期时,我不知道从哪里开始寻找提示。 (我尝试过在各种上下文中单击,w-w/o selection,w/o image。)在
我能够从http://gimpbook.com/scripting/复制并执行示例插件 我得到了,正在工作,但是当我所做的更改破坏了某些东西时,我不知道是什么,并且一行一行地改变现有程序是乏味的(每次都必须关闭并重新启动gimp)
所以总结一下-
1-我可以在不重启gimp的情况下刷新插件吗?(所以至少我的慢变形会更快)
2-我可以从python fu shell运行插件吗。(而不是仅仅导入它们以确保它们解析。)
3-是否有我丢失的错误日志,或类似的东西?在
4-有没有办法在windows上从shell运行gimp来查看输出?(在cygwin(或virtualbox..)下我会更好吗?在
5-我还没有找到如何将winpdb连接到现有进程。如何将它连接到运行在gimp中的python进程?在
谢谢
我是python的新手,但我想先对winpdb大声疾呼,然后再对这个将winpdb集成到GIMP的评论发表意见。 同样的过程也适用于libreoffice4。在
如果允许我发泄一下的话,我对visualbasic有一定的经验,或多或少是在最糟糕的水平上,但几年前,当微软威胁要放弃VB而改用Mac时,我决定进入OpenOffice。我不想说VB在OpenOffice中是繁重的,但是缺少任何类似IDE的东西是乏味的。现在,有了winpdb,我再也不会回头了。从现在开始就是Python了,宝贝。在
采取的步骤:
正如上面Omid所建议的,我首先让winpdb用完GIMP(相对来说是无痛的)。在
我将rpdb2.py文件复制到C:\Program Files\LibreOffice 4\Program\python-core-3.3.3\lib\site packages\rpdb2.py。(胜利7,图书馆4.4.03)
我编辑了地狱世界.pyC:\Program Files\LibreOffice 4\share\Scripts\python目录中的文件(保存在WinPDb中_地狱世界.py到同一目录)。在
WinPDb\u HelloWorld出现在宏选择器的LibreOffice宏下(有关详细信息,请参见https://wiki.openoffice.org/wiki/Python_as_a_macro_language)。在
(无法以来宾身份向您显示图片)
添加脚本或更改register()时必须重新启动GIMP。 更改脚本的其他部分时无需重新启动它作为单独的进程运行,每次都将从磁盘重新读取。在
有用来源: http://gimpbook.com/scripting/notes.html
是的,您可以通过以下方式访问已注册的插件
python-fu
控制台:可以这样称呼它:
^{pr2}$同样在
python-fu
对话框控制台中,您可以单击Browse ..
选项并找到您注册的插件, 然后单击Apply
,将其导入python-fu
控制台。在有用来源: http://registry.gimp.org/node/28434
要进行日志记录,可以定义如下函数:
并在您的代码中随时使用它。在
要查看日志,在
gimp
程序中,在Windows
菜单中打开Error Console
fromDockable Dialogs
,否则每次创建日志时都会弹出一个消息框。在您还可以将
stdin
和stdout
重定向到一个文件:执行此操作时,
exceptions
将转到err.txt
,所有打印输出都将转到log.txt
请注意,使用a
选项而不是w
打开文件来保存日志文件。在有用的来源:
How do I output info to the console in a Gimp python script?
http://www.exp-media.com/content/extending-gimp-python-python-fu-plugins-part-2
我有一些错误,但可以再试一次。。。在
首先安装winpdb,同时安装wxPython(Winpdb GUI依赖于wxPython)
注意,
Gimp
有自己的python解释器,您可能想将winpdb
安装到默认的python解释器或gimp python解释器。在如果将
winpdb
安装到默认的python解释器,则需要将rpdb2.py
安装的文件复制到gimp python解释器路径的..\Lib\site-packages
。在之后,您应该能够从gimp的
Python-Fu
控制台导入pdb2
模块:现在在插件代码中,例如在main函数中添加以下代码:
接下来,转到gimp并运行您的python插件,当您运行插件时,它将运行,然后等待到达上面的代码。在
现在要打开
Winpdb GUI
,请转到..\PythonXX\Scripts
,然后运行winpdb_.pyw
。在(请注意,使用Winpdb进行远程调试时,请确保途中的任何firewall已打开TCP端口51000。请注意,如果使用端口51000,Winpdb将搜索51000和51023之间的替代端口。)
然后在
Winpdb GUI
中的File
菜单中选择attach
,并给pass
作为密码,然后您可以在该列表中看到您的插件脚本,选择它并一步一步开始调试。在有用资源: Installing PyGIMP on Windows
有用的来源:
http://wiki.gimp.org/index.php/Hacking:Plugins
http://www.gimp.org/docs/python/index.html
http://wiki.elvanor.net/index.php/GIMP_Scripting
http://www.exp-media.com/gimp-python-tutorial
http://coderazzi.net/python/gimp/pythonfu.html
http://www.ibm.com/developerworks/opensource/library/os-autogimp/os-autogimp-pdf.pdf
如How do I output info to the console in a Gimp python script?所述
添加
在插件文件的开头。在
相关问题 更多 >
编程相关推荐