<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic AssertionError: Invalid MXD filename...why? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/assertionerror-invalid-mxd-filename-why/m-p/334449#M26082</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a simple script for batch exporting .mxds to .PNG:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy, os ws = arcpy.env.workspace = r"X:\DATA\07_Reporting\MapDocuments\UTC_Factsheet_ANCs" outDir = r"C:\_Rich\Project_Temp\dc\MapTest"&amp;nbsp; mapList = arcpy.ListFiles("*.mxd") for m in mapList: &amp;nbsp;&amp;nbsp;&amp;nbsp; print m &amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(ws + m) &amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.mapping.MapDocument(mxd) &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPNG(mxd, outDir + '\\' + str(m)) &amp;nbsp;&amp;nbsp;&amp;nbsp; del mxd&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've used this code several times before. I don't think I've modified it at all, except for the workspace and outdirectory.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Today, I am getting the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "X:\DATA\INRMP_JPG\Tools\Scripts\export_mxd_to_PNG_Smoky.py", line 10, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(m)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\mixins.py", line 443, in __init__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; assert (os.path.isfile(mxd) or (mxd.lower() == "current")), gp.getIDMessage(89004, "Invalid MXD filename")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AssertionError: Invalid MXD filename.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note: Neither my filenames or mxd names have any spaces in them (although that hopefully would be okay).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need this bad because i have many maps to convert.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Help on this would be awesome.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Running Arcgis 10.0 sp4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;win7 64bit&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rich&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 May 2012 14:29:06 GMT</pubDate>
    <dc:creator>RichardThurau</dc:creator>
    <dc:date>2012-05-14T14:29:06Z</dc:date>
    <item>
      <title>AssertionError: Invalid MXD filename...why?</title>
      <link>https://community.esri.com/t5/python-questions/assertionerror-invalid-mxd-filename-why/m-p/334449#M26082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a simple script for batch exporting .mxds to .PNG:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy, os ws = arcpy.env.workspace = r"X:\DATA\07_Reporting\MapDocuments\UTC_Factsheet_ANCs" outDir = r"C:\_Rich\Project_Temp\dc\MapTest"&amp;nbsp; mapList = arcpy.ListFiles("*.mxd") for m in mapList: &amp;nbsp;&amp;nbsp;&amp;nbsp; print m &amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(ws + m) &amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.mapping.MapDocument(mxd) &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPNG(mxd, outDir + '\\' + str(m)) &amp;nbsp;&amp;nbsp;&amp;nbsp; del mxd&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've used this code several times before. I don't think I've modified it at all, except for the workspace and outdirectory.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Today, I am getting the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "X:\DATA\INRMP_JPG\Tools\Scripts\export_mxd_to_PNG_Smoky.py", line 10, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(m)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\mixins.py", line 443, in __init__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; assert (os.path.isfile(mxd) or (mxd.lower() == "current")), gp.getIDMessage(89004, "Invalid MXD filename")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AssertionError: Invalid MXD filename.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note: Neither my filenames or mxd names have any spaces in them (although that hopefully would be okay).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need this bad because i have many maps to convert.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Help on this would be awesome.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Running Arcgis 10.0 sp4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;win7 64bit&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rich&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2012 14:29:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/assertionerror-invalid-mxd-filename-why/m-p/334449#M26082</guid>
      <dc:creator>RichardThurau</dc:creator>
      <dc:date>2012-05-14T14:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: AssertionError: Invalid MXD filename...why?</title>
      <link>https://community.esri.com/t5/python-questions/assertionerror-invalid-mxd-filename-why/m-p/334450#M26083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This looks like the problem here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;mxd = arcpy.mapping.MapDocument(ws + m)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;This would output this&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"X:\DATA\07_Reporting\MapDocuments\UTC_Factsheet_ANCsyour_mxd.mxd"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You'd want something like&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;mxd = arcpy.mapping.MapDocument(os.path.join(ws,m))&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2012 14:34:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/assertionerror-invalid-mxd-filename-why/m-p/334450#M26083</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-05-14T14:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: AssertionError: Invalid MXD filename...why?</title>
      <link>https://community.esri.com/t5/python-questions/assertionerror-invalid-mxd-filename-why/m-p/334451#M26084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'll have to chalk this one up to Monday morning &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Mathew!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2012 14:41:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/assertionerror-invalid-mxd-filename-why/m-p/334451#M26084</guid>
      <dc:creator>RichardThurau</dc:creator>
      <dc:date>2012-05-14T14:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: AssertionError: Invalid MXD filename...why?</title>
      <link>https://community.esri.com/t5/python-questions/assertionerror-invalid-mxd-filename-why/m-p/334452#M26085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Richard or Matthew, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do either of you know how to convert this to be used as a tool?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2012 20:45:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/assertionerror-invalid-mxd-filename-why/m-p/334452#M26085</guid>
      <dc:creator>ClarkMitten</dc:creator>
      <dc:date>2012-10-22T20:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: AssertionError: Invalid MXD filename...why?</title>
      <link>https://community.esri.com/t5/python-questions/assertionerror-invalid-mxd-filename-why/m-p/334453#M26086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can create tools from python scripts following the process here: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001500000006000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001500000006000000.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Follow these directions to create a tool that can be saved in any ArcToolbox, which is a great way to organize scripts btw.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;RT&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2012 20:59:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/assertionerror-invalid-mxd-filename-why/m-p/334453#M26086</guid>
      <dc:creator>RichardThurau</dc:creator>
      <dc:date>2012-10-22T20:59:04Z</dc:date>
    </item>
  </channel>
</rss>

