I have a MDCS. The script runs without problems in Windows, starting it with a batch file. The aim is to have it running on ArcGIS Server. How can I run it from a toolbox script?

1 Answer 1


It can be done with a toolbox, importing MDCS.py and calling it's main()-function with the two parameters. The list needs to have at least 2 elements, one of them being the path to the xml file (because the command line or batch file delivers the mdcs.py path as one parameter). The execute script of the toolbox could be:

import sys
sys.path.insert(0, '...\mdcs-folder\scripts')
import arcpy
import MDCS
from pathlib import Path
import os

def ScriptTool(param0):
    config = "...\mdcs-folder\Parameter\Config\name.xml")).as_posix() 
    list = ["x", f"-i:{config}"]
    argc = len(liste)
    MDCS.main(argc, list)
if __name__ == '__main__':
    ordner_neue_Raster = arcpy.GetParameterAsText(0)

Half the answer is also given in this video at 23:14, but the script is not shown entirely...but it is probably more elegant.


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.