I have some Python code, specifically arcpy related, that I am having trouble debugging. Essentially the error I am getting is the same as in this question:

Python crashes during large cursor process

However I have not been able to figure out where this is occuring as it appears to me I am cleaning up soon after Cursor usage.

The script is, at least I think, too long to post here. I note that in this post: How much code is appropriate for an answer? there is a mention that a page or more of code shows the user has not bothered to narrow down the question. I tend to agree with this. However as it stands I feel this is necessary.

Having said that I think the code could be somewhat useful to some GIS.SE users as the error only occurs in some instances which I could clarify. In this sense I am happy to make it available for use by the community and just ask for help from anyone who encounters the same issue and has the skills to debug.

This is still somewhat theoretical as I have no idea where I would host the script as yet but it is something I am looking at doing in the future either way. Another question is that if the site was a blog would it be seen as shameless self promotion?

  • How many lines of code are we talking about? Commented Jun 20, 2012 at 11:54
  • post the code with the { } 'code' option in the editor this will accommodate it on the page with scroll bars.
    – Mapperz Mod
    Commented Jun 20, 2012 at 13:15
  • Entire length of code is about 700 lines. Could probably narrow this down to about 350 by cutting out linked scripts.
    – EnE_
    Commented Jun 21, 2012 at 1:20

2 Answers 2


Generally speaking, and this sounds like it may not be true your case but it tends to be true, if the code is too large to include in a question it's also likely to be too large or complicated for others to help you with as well. Breaking the problem down into the smallest possible reproducible case will, often, also make it more amenable to posting.

For every question of code I post here there are 3 that I don't, because the very process of breaking the problem down into a manageable question size reveals the error and solution. That is, the act of writing the question can be more valuable than the eventual responses.

(And sometimes even after discovering the solution this way I go ahead post a version of the Q anyway, because if it took an hour or two of my time it's worth saving someone else the same.)

That said, if it's still too big what I do is post a code example of what I think the most relevant or troublesome parts of the code are in the question, and then link to a full version offsite somewhere; I like pastebin.com, they've been around a long time and provide a stable service.


Another question is that if the site was a blog would it be seen as shameless self promotion?

If it's a one liner with a link, that's unwanted self promotion. It is definitely okay if the question or answer here is self sufficient, in at least the essential principles and key concepts, with a link to a full and proper treatment elsewhere.

I'll also put in a plug here that it could be a candidate for our own GIS.se blog, which is a tad content poor.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .