I made a tool in ArcGIS Python Add-Ins for my colleagues and right now wrote an update in main script. It would be easy to tell everyone to delete old add-in and install new one, but recently found the path to the initial script of a tool which is C:\Users\%username%\AppData\Local\ESRI\Desktop10.2\AssemblyCache\folder with a long name\file.py. I tried to make a script that could make a backup of file.py to file_backup.py, take a new file and paste it in found folder. Script works well, the new file with new updates is there, but when I launch ArcMap there are no any changes. I can see that the file is the same that I used before.
Is it technically possible to perform this operation using the change of files?
The script is:
import os
import shutil
loc = os.environ.get('LOCALAPPDATA')
filename = 'Pointer_addin.py'
for x in os.walk(loc):
if filename in str(x) :
print os.path.join(x[0],filename)
path = x[0]
filepath = os.path.join(x[0],filename)
os.rename(filepath,filepath.rstrip('.py') + '_backup.py')
newp=r'D:\Pointer\Install\Pointer_addin.py'
shutil.copy(newp,path)