Hi,I've scripted something that does what you described excepted that no .csv file is added to the map. I'm not sure you really need the csv in the mapDocument but if you really do, try to google something like 'arcpy 10.1 AddTableView'I let you read the comments in the code to understand the process.Only 'toto.mxd' and 'test.csv' exist at the first place. 'toto.lyr' and 'toto.shp' are generated from the scriptI've attached the folder that contains the whole thing just in caseHere you go :
import arcpy, os
from arcpy import env
env.overwriteOutput = True # -----------------------------------------------------> IF YOU WANT THE OUTPUT TO BE OVERWRITED
# ------- DEFINE VARIABLES
directory = r'D:\GAIA\AG\script' # -------------------------------------------------> WHERE MY STUFF IS
mxd = arcpy.mapping.MapDocument(os.path.join(directory, r'toto.mxd')) # ------------> MXD REFERENCE
tableCSV = os.path.join(directory, r'test.csv') # ----------------------------------> TABLE REFERENCE
temp_Layer = os.path.join(directory,r'toto.lyr') # ---------------------------------> NAME FOR THE TEMPORARY LAYER TO BE GENERATED FROM 'MakeXYEventLayer_management'
temp_Layer_toShapefile = os.path.join(directory,r'toto.shp') # ---------------------> NAME FOR THE SHAPEFILE TO SAVE
# -------- CREATE XY EVENT TABLE AND SAVE IT AS A SHAPEFILE :
arcpy.MakeXYEventLayer_management(tableCSV, "X_COORD", "Y_COORD", temp_Layer) # ----> TABLE TO XY Event LAYER (temporary Layer) (inputTable, ColumnNameForX, ColumnNameForY, LayerToSave)
arcpy.CopyFeatures_management(temp_Layer, temp_Layer_toShapefile) # ----------------> COPY TEMP LAYER TO PROPER SHAPEFILE
# -------- ADD SHAPEFILE TO THE MAP :
layer_ToAdd = arcpy.mapping.Layer(temp_Layer_toShapefile) # ------------------------> CAST SHAPEFILE AS LAYER OBJECT
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] # ------------------------------> DATAFRAME REFERENCE IN MXD (DEFAULT = "Layers")
arcpy.mapping.AddLayer(df, layer_ToAdd, "TOP") # -----------------------------------> ADD LAYER TO MXD
# -------- SAVE, CLEAN UP, EXIT
mxd.save() # -----------------------------------------------------------------------> SAVE MXD
del mxd
del temp_Layer_toShapefile # --------------------------------------------------------------------------> DELETE MEMORY REFERENCE TO THE MXD (kill lock)
print 'JOB DONE'