I need my toolboxes path. These are in the installation folder (toolboxes) but when using the function:

dir_tools = os.path.join(os.path.dirname(__file__),r'toolboxs\parametros.tbx')

result: C:\Users\xxx\AppData\Local\ESRI\Desktop10.4\AssemblyCache{8F89910B-C991-4EAA-B2A5-294D1F72C1A4}\toolboxs\parametros.tbx

Return path of system, not path installation folder.

How do I get the path of the installation folder?


This is not quite what you want, but you may be able to adapt it for your purposes.

import os
import arcpy
from os.path import expanduser

home = expanduser("~")
arcGISver = arcpy.GetInstallInfo()['Version']
path = r"{}\AppData\Roaming\ESRI\Desktop{}\ArcToolbox\My Toolboxes".format(home,arcGISver)

The basic idea is that these paths tend to be mostly static and we can rely on Python and arcpy functionality to fill in for parts that do change.

Not the best solution - I'd prefer some built-in function call in arcpy, but that doesn't appear to exist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.