AnsweredAssumed Answered

ApplySymbologyFromLayer  does not work in my python code

Question asked by monir_mostafizur1 on Dec 27, 2015
Latest reply on Dec 27, 2015 by monir_mostafizur1


I have  a layer file. I make a button in ArcGIS 10 with .NET. I want to change layer symbology with the layer file. For this purpose I Write python code and execute it from C#. If the following code is written in python window of ArcGIS, then works fantastic. But from my code, it does not work. Can anyone help me ??




               const string prg = @"import sys

import arcpy

from arcpy import env

mxd = arcpy.mapping.MapDocument('CURRENT')

layer = arcpy.mapping.ListLayers(mxd)[0]




               var sw = new StreamWriter("D:\\");

               sw.Write(prg); // write this program to a file


               var p = new Process


                               StartInfo =


                                       FileName = @"C:\Python26\ArcGIS10.0\python.exe",

                                       RedirectStandardOutput = true,

                                       UseShellExecute = false,

                                       Arguments = "D:\\ "


                           }; // create process (i.e., the python program



Thanks ...