Select to view content in your preferred language

Embedded python code suddenly gone

427
4
12-12-2024 05:42 AM
RandyMcGregor_BMcD
Frequent Contributor

This happens with some regularity. The embedded script in a python script tool gets replaced by the filepath to to the temp *.py file for the code. I am refraining from using embedding scripts for now because of this but if anyone knows why this is happening, I would be most grateful. It is handy to use embedded scripts. Thank you,

Randy McGregor

RandyMcGregor_BMcD_0-1734010876643.png

 

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

Edit script tool code—ArcGIS Pro | Documentation describes two methods, only one indicates that the toolbox's embedded code gets updated.

This is apparently a followup to your previous post

Embedded Python Code Disappearing - Esri Community

If the help topics need clarification or this is in error, it may be worth comment in the .... Feedback on this topic? ... link.  I find that comments generally make it back to the appropriate team

PS  I never embed because of the temporary file creation issue/aspect


... sort of retired...
0 Kudos
RandyMcGregor_BMcD
Frequent Contributor

Thank you, I have worked with embedded code a fair amount both within the 'properties' execution window and by opening the temporary .py file. Both work fine, and both will update the code, but sometimes the embedded code is simply replaced by the file path to the temporary file, and it's all over. I could have accidentally done this once, but it happens regularly and I'm not quite that absent minded :).

This is most definitely some sort of glitch, whether in ESRI's system or our own, I don't know. The topic explains how to update the code, but what I'm experiencing is not really a problem with the documentation, so not sure what feedback I could provide there. May open a support ticket at this point. 

It is a second post. Was hoping maybe someone else might have run into this in the meantime 😕 Anyway, thanks for the feedback. Looks like this one is just a mystery. I will avoid embedding code from now on.

DarinaTchountcheva
Frequent Contributor

Hello Randy,

Just experienced this today and all of my code is gone. 

I can recover most of it from copies of the project that I had but not the latest changes. 

This is really frustrating. 

I am using the embedded code, so I can protect the code with a password and protect users from their curiosity. 

I have no explanation of what has happened, but just wanted to confirm that it is not just you that have experienced this. 

 

 

RandyMcGregor_BMcD
Frequent Contributor

Thanks for the information, but sorry this happened to you. I just gave up on embedded code. This is a VERY weird one. Overall, working with python code in ArcPro has been quite unstable compared to ArcMap. Editing validation code is cumbersome as well. When you open the temp. validation script and edit it and save, you have to close it down and reopen to make more changes as they don't register after the first save.

0 Kudos