python toolbox "no syntax errors" yet non-functional

896
6
05-08-2013 01:52 PM
JamieKass
Occasional Contributor
I make many small changes to the code in my Python Toolbox on a daily basis, and therefore often refresh the toolbox to solidify the changes before running the tool. Usually when I have a syntax error, I am notified when I right-click of the location of the error. However, and I've noticed this a number of times, the message will be "no syntax errors" while the red X remains. In these cases, I am forced to find the part of the code ArcGIS doesn't like. This error does not always translate to a Python syntax error, so compiling to find errors quickly does not work all the time. If a red X is present and my tool is not accessible, the Python Toolbox should be able to notify me where the error is all the time. Has anyone else found this issue?
Tags (2)
0 Kudos
6 Replies
JennB
by
New Contributor III
No matter how great a debugger is, they can only be so good at finding what are called "logical" errors. Syntax errors are just that--perhaps a missing colon or indentation. Logical errors mean that the way you've tried to solve a problem is incorrect.

For clarification, do these tools just stop working after some period of time even if you haven't ever edited them? Or are you changing them and then realizing they don't work? And one more point of clarification: are the errors you're being required to manually locate actually syntax errors? I don't think that part was quite clear to me.
0 Kudos
JamieKass
Occasional Contributor
Let me clarify -- my .pyt calls other custom modules, and if there is a syntax error in one of these modules, a red X appears (rendering the toolbox unusable) and the message is "no syntax errors" even though there is one, though not in the .pyt. Shouldn't the debugger be able to point me to the file with the error? My particular syntax error arose because I am using GitHub and had a merge conflict, which wrote a bunch of lines like "<<<<<<HEAD" as guidance for manual edits. Since one of the custom module scripts had the error, compiling the .pyt worked fine, but as the module is imported, opening the toolbox in ArcGIS won't work. Could there be more direction to errors in imported modules? Otherwise, debugging becomes difficult.
0 Kudos
JamieKass
Occasional Contributor
Now having an identical error, yet no GitHub merge conflict text. Even turned on SublimeLinter in SublimeText2 to try and find errors, and came up with nothing. If these are not syntax errors, and are in fact logic errors, why does the .pyt shut down completely and not let me run through the logic of the tool and experience the error myself? Currently, the .pyt has a big red X and tells me "no syntax errors". Any help?
0 Kudos
ChrisPedrezuela
Occasional Contributor III
Could you post your code for the python toolbox?

Now having an identical error, yet no GitHub merge conflict text. Even turned on SublimeLinter in SublimeText2 to try and find errors, and came up with nothing. If these are not syntax errors, and are in fact logic errors, why does the .pyt shut down completely and not let me run through the logic of the tool and experience the error myself? Currently, the .pyt has a big red X and tells me "no syntax errors". Any help?
0 Kudos
JamieKass
Occasional Contributor
There are over a thousand lines, plus 6 other .py files that get called with close to 500 lines each, so it's not feasible to publish the whole thing. Plus, it's proprietary =D
I suppose I'd need someone at ESRI to take a look at it.
0 Kudos
JamieKass
Occasional Contributor
I apologize, but it turns out this is a repeat of a previous issue:
http://forums.arcgis.com/threads/69714-Debug-Python-Toolbox

Again, a syntax error, this time in a dictionary comprehension, foiled my Python Toolbox. Since it was a syntax error in Python, I figured the debugger should be able to inform me of it. Why does it pick up some errors and ignore others?
0 Kudos