I created a script to envolve points with polygons using the same value or ID. The main tool was the "Minimum Bounding Geometry", and so far my script is working good, but to convert to toolbox script It doesn't work good. I introduced the parameters but nothing happens, even do no errors show up. I verified the manual to convert the script to toolbox script but nothing solve this issues.

Someone can help me?

How I can convert correctly the script to toolbox or my script have a problem?

This is my script:

import arcpy, os, datetime

#Variables de entorno
Introduce_shp = arcpy.GetParameterAsText(0)
Ruta_salida = arcpy.GetParameterAsText(1)

arcpy.AddMessage('Introduce el shp de entrada:'+ Introduce_shp)
arcpy.AddMessage('Ruta de salida:'+ Ruta_salida)

Fecha = datetime.datetime.now()
dia = Fecha.day
mes = Fecha.month
year= Fecha.year
Nombre_archivo_shp = '{0}{1}{2}_Areas_almacenes_DICONSA.shp'.format(dia,mes,year)

#Une ruta y archivo
Ruta_salida_poligonos = os.path.join(Ruta_salida,Nombre_archivo_shp)

#Realiza proceso de areas
arcpy.MinimumBoundingGeometry_management(Introduce_shp, Ruta_salida_poligonos, "CONVEX_HULL", "LIST", "CVE_ALMACE", "NO_MBG_FIELDS")

However this gives an error.

Can somebody tell me how to solve the problem?

Running script Script1...

Introduce el shp de entrada:D:\SedesolVQB\Proyectos\proyecto_INFRASOCIAL\Capas_infraestructura_social\Capas de abril2017\n_loctdico_0417_09_.shp
Ruta de salida:D:\Documentos\ArcGIS\n_loctdico_0417_09__Script1.shp

Traceback (most recent call last):
  File "D:\SedesolVQB\Proyectos\proyecto_MODELBUILDER_DGAAE\Areas_almacenes_v12.py", line 30, in <module>
    arcpy.MinimumBoundingGeometry_management(Introduce_shp, Ruta_salida_poligonos, "CONVEX_HULL", "LIST", "CVE_ALMACE", "NO_MBG_FIELDS")
  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py", line 2576, in MinimumBoundingGeometry
    raise e
ExecuteError: ERROR 000210: Cannot create output D:\Documentos\ArcGIS\n_loctdico_0417_09__Script1.shp\1462017_Areas_almacenes_DICONSA.shp
Failed to execute (MinimumBoundingGeometry).
  • 1
    You need a comma between the two variables in os.path.join
    – klewis
    Jun 13, 2017 at 22:50
  • thanks for your answer but continue the same issues, nothing happens Jun 13, 2017 at 23:41
  • With Nombre_archivo_shp, if you're supplying a raw string with r' you don't need to double backslash, in fact if you're joining you don't supply a backslash at all : Nombre_archivo_shp = str(dia)+str(mes)+str(year)+ '_Areas_almacenes_DICONSA.shp' then Archivo_salida = os.path.join(Guarda_el_shp_salida, Nombre_archivo_shp). What exception do you get when it fails? Jun 14, 2017 at 0:13
  • Thansk for you help!!! I did what you said but nothing happens,no erros, notthing happens. I thing the problem is the join datetime with string'_Areas_almacenes_DICONSA.shp' and then the arguments in the arcpy.MinimumBoundingGeometry_management --> Archivo_salida Jun 14, 2017 at 0:33
  • 1
    @MichaelMiles-Stimson if you're supplying a raw string with r you don't need to double backslash - While I agree that the backslash is not needed, you cannot end a raw python string with a single backslash, so r'\' would give a Parsing Syntaxerror
    – Midavalo
    Jun 14, 2017 at 2:34

1 Answer 1


We cannot see what the tool user enters for the two parameters, so I think you need to print out their contents:

From the error at the end it looks like you have set:

Introduce_shp = 1462017_Areas_almacenes_DICONSA.shp
Ruta_salida = D:\Documentos\ArcGIS\n_loctdico_0417_09__Script1.shp

and that you have tried to concatenate a full path to a shapefile (including its name) with a shapefile name to make a pathname, instead of concatenating a workspace path and a file name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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