Select to view content in your preferred language

Cleaning issues

679
1
Jump to solution
04-17-2021 05:26 AM
Mick
by
Emerging Contributor

I am currently working with a geodatabase. I have the main script and multiple functions that the script calls.

However, some functions can call the same additional functions inside them.

The issue is that I have an error that my main script can not finish the process.

However, each function works perfectly. Moreover, I have an issue with the last two functions in my script, so the first function from them (two last functions) will work the second won't. If I change them the first one will work no matter which one. Additionally, I can finish the process if I call the failed function but put it as the first.

I have several loops, several layers and  lists.

- I deleted the cursor after each loop and layers at the end of each operation ( del and arcpy.Delete_management).

- I deleted each list at the end of each operation (del list)

- I gave different names for the same layers or list when I called them inside of the different functions.

- I updated my initial folder every time to be sure that the previous process would impact.

- I restarted my computer.

Now I think that the same function could impact the process. Moreover, when I use the debugger I can see Python misses the lines in a loop that leads to the issue.  It happens when I call the same function that I called in the previous function.

Could you please recommend me anything?

 

 

0 Kudos
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor

Given you haven't mentioned which application, programming language, or environment you are using... and no code examples or error messages...

It sounds you may be using arcpy cursors - these are best used with a "with" construct (see the help) instead of manually deleting them (with del, not arcpy.Delete_management, which is for datasets and layers).

It sounds like you are trying to be very complex, I suggest breaking your problem into smaller pieces, get them working, and re-build by aggregating working pieces.

If you are using arcpy and Pro, I have found the new Jupyter notbook functionality in Pro to be really great for getting pieces of code working.

View solution in original post

0 Kudos
1 Reply
curtvprice
MVP Esteemed Contributor

Given you haven't mentioned which application, programming language, or environment you are using... and no code examples or error messages...

It sounds you may be using arcpy cursors - these are best used with a "with" construct (see the help) instead of manually deleting them (with del, not arcpy.Delete_management, which is for datasets and layers).

It sounds like you are trying to be very complex, I suggest breaking your problem into smaller pieces, get them working, and re-build by aggregating working pieces.

If you are using arcpy and Pro, I have found the new Jupyter notbook functionality in Pro to be really great for getting pieces of code working.

0 Kudos