GIMP Chat http://gimpchat.com/ |
|
How to know why a python plug-in is failing http://gimpchat.com/viewtopic.php?f=9&t=751 |
Page 1 of 1 |
Author: | john_whorfin [ Tue Nov 23, 2010 12:05 am ] |
Post subject: | How to know why a python plug-in is failing |
noob here. Say there's a problem with a python script. e.g., I forgot a paren somewhere. The result is that my plug-in isn't available on the menu. I presume because the script quit before it registered. Where is that syntax error going? If I could see the errors coming from the script, I could find the culprit faster. Thanks. |
Author: | john_whorfin [ Tue Nov 23, 2010 12:06 am ] |
Post subject: | Re: How to know why a python plug-in is failing |
Forgot to say: Running GIMP 2.6.11 on Win 7. |
Author: | mahvin [ Tue Nov 23, 2010 1:32 am ] |
Post subject: | Re: How to know why a python plug-in is failing |
A start would be to use the Python console in GIMP: http://registry.gimp.org/node/24275 |
Author: | john_whorfin [ Tue Nov 23, 2010 1:58 am ] |
Post subject: | Re: How to know why a python plug-in is failing |
Thanks, mahvin. There's a lot of useful information there that I was unaware of. However, I couldn't find an answer to my question. I'm trying to figure out: where do the python errors go when there is a syntax error in the script? |
Author: | mahvin [ Tue Nov 23, 2010 3:21 am ] |
Post subject: | Re: How to know why a python plug-in is failing |
I don't know the answer to your question, specifically. I use NetBeans or IDLE to run/check syntax and indentation for errors. |
Author: | GnuTux [ Tue Nov 23, 2010 4:19 am ] |
Post subject: | Re: How to know why a python plug-in is failing |
john_whorfin wrote: I'm trying to figure out: where do the python errors go when there is a syntax error in the script? Greets John, I'm not a GIMP python person and I don't know the direct answer to your question in Windows but interpreted languages, like python and scheme, normally direct output to the console (or to GUI message dialog). This is the case in Linux. If python-fu isn't displaying those messages in a GUI dialog or in the python-fu console, you might try redirecting GIMP messages to the Windows console. Code: Select all gimp --console-messages You can check "gimp --help" on your system to see which options are compiled in. Here is my gimp --help Code: Select all ]$ gimp -help Another thought would be to try running GIMP with the --verbose option. You could also try running the plug-in directly from the command line but I don't know the exact syntax for that in Windows, uses something like "gimp-console", I believe. Look for the those executables and check their options. There are a couple of python "code checkers" out there like PyChecker or PyLint, which might be useful in debugging syntax errors. Push comes to shove, start your plug-in as skeleton code and add small sections in at a time, testing as you go. Sorry I couldn't assist more but maybe some of those suggestions will help. |
Author: | GnuTux [ Tue Nov 23, 2010 4:30 am ] |
Post subject: | Re: How to know why a python plug-in is failing |
Oh, and a python editor with color syntax highlighting might be helpful too. I'm sure there are a few good freebies out there for the Windows platform. |
Author: | Bob63 [ Tue Nov 23, 2010 9:42 am ] |
Post subject: | Re: How to know why a python plug-in is failing |
Although I don't do much programming, check out notepad++ on sourceforge. It is a free text editor that is syntax-aware for many programming languages (about 50, by my count) from Ada to YAML. It can do syntax highlighting for the selected language, find mis-matched parens, change document encodings, does unicode, and much more - and it runs on Windows and on Linux under Wine. It might be helpful to you in finding errors in your program. I used it when I was on Windows, and on Linux found it a big help opening those problem text files and code that sometimes gives gedit problems due to encoding issues. (Although not so helpful, it can even open most binary files.) As of today, the most recent version is 5.8.4. See it here on Sourceforge. I see one of the commenters posted that "Notepad++ is to text editors what IrfranView is to image viewers." Having used both programs, I have to agree. That may or may not mean much to Linux users, but Irfanview is sort of a Swiss Army Knife image viewer and simple image editor for Windows that can open pretty much any image...and also runs on Linux under Wine. |
Author: | molly [ Tue Nov 23, 2010 10:01 am ] |
Post subject: | Re: How to know why a python plug-in is failing |
I agree. I have been using notepad++ for 3 yrs now. It is great for viewing scripts and plugins also. There is also Notepad++ portable, http://filepig.org/download/notepad_plus_plus_portable/ |
Author: | Rod [ Wed Nov 24, 2010 4:06 am ] |
Post subject: | Re: How to know why a python plug-in is failing |
Yes Notepad ++ is awesome. I believe you can run any python script in a wsys command line window and see the errors there.cygwin works as well i believe.As long as you have python installed , and they see the path it should work. Here is a command window through cygwin throwing an error for not finding certain files to run it. Compaq_Owner@Family-Room ~ $ ./scrnshot_tearoff.py Traceback (most recent call last): File "./scrnshot_tearoff.py", line 43, in <module> from gimpfu import * ImportError: No module named gimpfu Compaq_Owner@Family-Room ~ $ |
Page 1 of 1 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |