Select to view content in your preferred language

Embedded Python Code Disappearing

381
3
10-15-2024 02:39 PM
Labels (2)
RandyMcGregor_BMcD
Frequent Contributor

Does anyone know why the code in my python script tools is sometimes replaced by the filepath to the file that holds embedded code when it is being edited? 'Execution' used to hold a whole bunch of code. 

Thank you,

Randy McGregor

RandyMcGregor_BMcD_0-1729028169723.png

 

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

You are using an external editor?

Does the code not reappear when you are done editing, save the edits, close the editor and refresh the toolbox? (may require closing and reopening the toolbox)


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

When I see that filepath, it's over. The code's gone. Can't get it back. I do have a *.py file saved and I used it to reconstitute the code. Using Idle for 3.0. But sometimes I edit right within the properties 'Execution' window. Keeps happening. I'm going to go old-school and have a separate *.py file feed the script. I have had this issue with embedded scripts periodically. It is truly distressing when you don't have a backup.

0 Kudos
RandyMcGregor_BMcD
Frequent Contributor

I decided to go with the separate *.py file, which is fine and is what I've done for years. The code is not disappearing anymore. I have noticed that if you are not careful and have more than one 'embedded code' window open, that can create (understandable) confusion which can result in the code being replaced by the path to the temporary file. That's not what happened here, BTW. Embedded code for Python tools just seems to be a bit flakey. This could be a bug?

0 Kudos