AnsweredAssumed Answered

Open shp with python

Question asked by lumart01 on Apr 6, 2017
Latest reply on Apr 6, 2017 by bixb0012

Hello all, I am trying  to create a python´s script to take a shapefile and open it on ArcMap .

 

This is my code :

--------------------------------------------------------------

import os,string,arcpy
os.system('ArcMap.exe C:\Users\Administrator.DBGS.000\Desktop\shap.mxd')
arcpy.MakeFeatureLayer_management("C:\Users\Administrator.DBGS.000\Desktop\shape\cities.shp")
arcpy.RefreshActiveView()
arcpy.RefreshTOC()

--------------------------------------------------------------

But this code only opens arcmap with shap.mxd and nothing more , however if  I open arcmap and copy the three last lines of my script in arcmap´s python window , it works and open the shape and show the layer.

 

Why it is working in arcmap´s python window but not with an external python script??

Any idea to open a shapefile automatically with code ??

 

Thanks a lot in advance¡

 

Luis.

Outcomes