Batch export mxd, python mapping module

Discussion created by rgthurau on Oct 21, 2011
Latest reply on Oct 21, 2011 by rgthurau
Hi esri community,
I'm trying to use a fairly simple script to export a list of map layouts (mxds) in a folder to pngs. should be easy but...

import arcpy
ws = arcpy.env.workspace = "X:\\Draft3Maps"
outDir = "X:\\Draft3_Map_graphics"

mapList = arcpy.ListFiles("*.mxd")
for mxd in mapList:
    print mxd
    arcpy.mapping.ExportToPNG(mxd, outDir + '\\' + str(mxd))
    del mxd

Error message:
Traceback (most recent call last):
  File "X:\export_mxd_to_PNG.py", line 8, in <module>
  File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\mixins.py", line 443, in __init__
    assert (os.path.isfile(mxd) or (mxd.lower() == "current")), gp.getIDMessage(89004, "Invalid MXD filename")
  File "C:\Apps\Python26\ArcGIS10.0\lib\genericpath.py", line 29, in isfile
    st = os.stat(path)
TypeError: coercing to Unicode: need string or buffer, list found

I know I'm probably close but probably missing something key. Any help is greatly appreciated.