<?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 Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383304#M30178</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I wrote a small python script that exports all mxd's in a folder to PDF's, but I get the following error in PyScripter and I don't know why...:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH]7866[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The python interpreter has whole bunch of red in it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Found 5 mxds for PDF exporting...
Directory: C:\Users\is0009\Desktop\temp

Exporting Rural_OCP_map_1_17x11.mxd to:
C:\Users\is0009\Desktop\temp\Rural_OCP_map_1_17x11.pdf
Traceback (most recent call last):
&amp;nbsp; File "&amp;lt;string&amp;gt;", line 70, in execInThread
&amp;nbsp; File "C:\Program Files (x86)\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\netref.py", line 123, in __call__
&amp;nbsp; File "C:\Program Files (x86)\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\netref.py", line 45, in syncreq
&amp;nbsp; File "C:\Program Files (x86)\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\protocol.py", line 343, in sync_request
&amp;nbsp; File "C:\Program Files (x86)\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\protocol.py", line 305, in serve
&amp;nbsp; File "C:\Program Files (x86)\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\protocol.py", line 265, in _recv
&amp;nbsp; File "C:\Program Files (x86)\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\channel.py", line 36, in recv
&amp;nbsp; File "C:\Program Files (x86)\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\stream.py", line 105, in read
EOFError: [Errno 10054] An existing connection was forcibly closed by the remote host&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Below is my script that I am trying:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The script is placed in a folder with a bunch of mxds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#Import python modules
import os, sys, string, glob, arcpy
from arcpy import mapping

#Set local variables
mxdLst = glob.glob('*.mxd')
mxdCnt = len(mxdLst)
####
#Place script in same folder as MXDs to get 'current working directory'
####
baseF = os.getcwd()

#Print how many mxd's found
print '\n' + 'Found ' + str(mxdCnt) + ' mxds for PDF exporting...'
print 'Directory: ' + str(baseF) + '\n'

#Loop to process each mxd into a PDF
for mxds in mxdLst:
&amp;nbsp;&amp;nbsp;&amp;nbsp; PDFr = mxds.replace('mxd', 'pdf') #Replace 'mxd' extension with 'pdf'
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Exporting ' + str(mxds) + ' to:' + '\n' + str(baseF) + '\\' + str(PDFr) #Print current mxd exporting and output pdf name...
&amp;nbsp;&amp;nbsp;&amp;nbsp; inMxd = arcpy.mapping.MapDocument(mxds) #Make current mxd in loop the mapdocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(inMxd, PDFr) #Export mapdocument to pdf
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Done exporting: ' + str(PDFr)
del mxds&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 16:24:32 GMT</pubDate>
    <dc:creator>DonovanCameron</dc:creator>
    <dc:date>2021-12-12T16:24:32Z</dc:date>
    <item>
      <title>Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2</title>
      <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383304#M30178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I wrote a small python script that exports all mxd's in a folder to PDF's, but I get the following error in PyScripter and I don't know why...:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH]7866[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The python interpreter has whole bunch of red in it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Found 5 mxds for PDF exporting...
Directory: C:\Users\is0009\Desktop\temp

Exporting Rural_OCP_map_1_17x11.mxd to:
C:\Users\is0009\Desktop\temp\Rural_OCP_map_1_17x11.pdf
Traceback (most recent call last):
&amp;nbsp; File "&amp;lt;string&amp;gt;", line 70, in execInThread
&amp;nbsp; File "C:\Program Files (x86)\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\netref.py", line 123, in __call__
&amp;nbsp; File "C:\Program Files (x86)\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\netref.py", line 45, in syncreq
&amp;nbsp; File "C:\Program Files (x86)\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\protocol.py", line 343, in sync_request
&amp;nbsp; File "C:\Program Files (x86)\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\protocol.py", line 305, in serve
&amp;nbsp; File "C:\Program Files (x86)\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\protocol.py", line 265, in _recv
&amp;nbsp; File "C:\Program Files (x86)\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\channel.py", line 36, in recv
&amp;nbsp; File "C:\Program Files (x86)\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\stream.py", line 105, in read
EOFError: [Errno 10054] An existing connection was forcibly closed by the remote host&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Below is my script that I am trying:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The script is placed in a folder with a bunch of mxds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#Import python modules
import os, sys, string, glob, arcpy
from arcpy import mapping

#Set local variables
mxdLst = glob.glob('*.mxd')
mxdCnt = len(mxdLst)
####
#Place script in same folder as MXDs to get 'current working directory'
####
baseF = os.getcwd()

#Print how many mxd's found
print '\n' + 'Found ' + str(mxdCnt) + ' mxds for PDF exporting...'
print 'Directory: ' + str(baseF) + '\n'

#Loop to process each mxd into a PDF
for mxds in mxdLst:
&amp;nbsp;&amp;nbsp;&amp;nbsp; PDFr = mxds.replace('mxd', 'pdf') #Replace 'mxd' extension with 'pdf'
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Exporting ' + str(mxds) + ' to:' + '\n' + str(baseF) + '\\' + str(PDFr) #Print current mxd exporting and output pdf name...
&amp;nbsp;&amp;nbsp;&amp;nbsp; inMxd = arcpy.mapping.MapDocument(mxds) #Make current mxd in loop the mapdocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(inMxd, PDFr) #Export mapdocument to pdf
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Done exporting: ' + str(PDFr)
del mxds&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:24:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383304#M30178</guid>
      <dc:creator>DonovanCameron</dc:creator>
      <dc:date>2021-12-12T16:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2</title>
      <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383305#M30179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Woohoo, new error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The script below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#Import python modules
import os, sys, string, glob, arcpy.mapping

#Set local variables
mxdLst = glob.glob('*.mxd')
mxdCnt = len(mxdLst)

####
#Place script in same folder as MXDs to get 'current working directory'
####
baseF = os.getcwd()

#Print how many mxd's found
print '\n' + 'Found ' + str(mxdCnt) + ' MXDs for exporting to PDF...'
print 'Directory: ' + baseF + '\n'


#For loop to process each mxd into a PDF
for mxds in mxdLst:
&amp;nbsp;&amp;nbsp;&amp;nbsp; #outPDF = mxds.replace('mxd', 'pdf') #Replace 'mxd' extension with 'pdf'
&amp;nbsp;&amp;nbsp;&amp;nbsp; #print 'Exporting ' + mxds + ' -&amp;gt; ' + outPDF
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;mxd = 'r' + '\"' + baseF + '\\' + mxds + '\"' #mxd with fullpathname&lt;/STRONG&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; #inMxd = arcpy.mapping.MapDocument(mxd) #Make current mxd in loop the mapdocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.mapping.ExportToPDF(inMxd, outPDF) #Export mapdocument to pdf
&amp;nbsp;&amp;nbsp;&amp;nbsp; #print 'Done exporting: ' + outPDF
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;print mxd&lt;/STRONG&gt;
del mxds&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Outputs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Found 5 mxds for PDF exporting...
Directory: C:\Users\is0009\Desktop\temp

r"C:\Users\is0009\Desktop\temp\Rural_OCP_map_1_17x11.mxd"
r"C:\Users\is0009\Desktop\temp\Rural_OCP_map_2_17x11.mxd"
r"C:\Users\is0009\Desktop\temp\Rural_OCP_map_3_17x11.mxd"
r"C:\Users\is0009\Desktop\temp\Rural_OCP_map_4_17x11.mxd"
r"C:\Users\is0009\Desktop\temp\Rural_OCP_map_5_17x11.mxd"&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;...where I am trying to pass the above 'string' as my MapDocument.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But when I modify the script to then use that string:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#Import python modules
import os, sys, string, glob, arcpy.mapping

#Set local variables
mxdLst = glob.glob('*.mxd')
mxdCnt = len(mxdLst)

####
#Place script in same folder as MXDs to get 'current working directory'
####
baseF = os.getcwd()

#Print how many mxd's found
print '\n' + 'Found ' + str(mxdCnt) + ' MXDs for exporting to PDF...'
print 'Directory: ' + baseF + '\n'


#For loop to process each mxd into a PDF
for mxds in mxdLst:
&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outPDF = mxds.replace('mxd', 'pdf') #Replace 'mxd' extension with 'pdf'
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Exporting ' + mxds + ' -&amp;gt; ' + outPDF
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = 'r' + '\"' + baseF + '\\' + mxds + '\"' #mxd with fullpathname
&amp;nbsp;&amp;nbsp;&amp;nbsp; inMxd = arcpy.mapping.MapDocument(mxd) #Make current mxd in loop the mapdocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(inMxd, outPDF) #Export mapdocument to pdf
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Done exporting: ' + outPDF&lt;/STRONG&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; #print mxd
del mxds&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Results in the following error from IDLE now:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Found 5 MXDs for exporting to PDF...
Directory: C:\Users\is0009\Desktop\temp

Exporting Rural_OCP_map_1_17x11.mxd -&amp;gt; Rural_OCP_map_1_17x11.pdf
Traceback (most recent call last):
&amp;nbsp; File "C:\Users\is0009\Desktop\temp\mxdloop.py", line 23, in &amp;lt;module&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; inMxd = arcpy.mapping.MapDocument(mxd) #Make current mxd in loop the mapdocument
&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\mixins.py", line 443, in __init__
&amp;nbsp;&amp;nbsp;&amp;nbsp; assert (os.path.isfile(mxd) or (mxd.lower() == "current")), gp.getIDMessage(89004, "Invalid MXD filename")
AssertionError: Invalid MXD filename.&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What is it that is making my MXD name invalid?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it because I am not handling the slashes in the filepath name correctly and they are considered invalid characters?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:24:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383305#M30179</guid>
      <dc:creator>DonovanCameron</dc:creator>
      <dc:date>2021-12-12T16:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2</title>
      <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383306#M30180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, glob, os

#Place script in same folder as MXDs to get 'current working directory'
baseF = os.getcwd()
print baseF

#Set local variables
mxdLst = glob.glob(baseF + '\\' + '*.mxd')
mxdCnt = len(mxdLst)

#Print how many mxd's found
print '\n' + 'Found ' + str(mxdCnt) + ' mxds for PDF exporting...'
print 'Directory: ' + str(baseF) + '\n'

#Loop to process each mxd into a PDF
for mxds in mxdLst:
&amp;nbsp;&amp;nbsp;&amp;nbsp; PDFr = mxds.replace('mxd', 'pdf') #Replace 'mxd' extension with 'pdf'
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Exporting ' + str(mxds) + ' to:' + '\n' + str(baseF) + '\\' + str(PDFr) #Print current mxd exporting and output pdf name...
&amp;nbsp;&amp;nbsp;&amp;nbsp; inMxd = arcpy.mapping.MapDocument(mxds) #Make current mxd in loop the mapdocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(inMxd, PDFr) #Export mapdocument to pdf
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Done exporting: ' + str(PDFr)
del mxds&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I specified &lt;/SPAN&gt;&lt;STRONG&gt;'baseF = os.getcwd()'&lt;/STRONG&gt;&lt;SPAN&gt; first and then added the baseF variable to the glob module, &lt;/SPAN&gt;&lt;STRONG&gt;'mxdLst = glob.glob(baseF + '\\' + '*.mxd')'&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:38:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383306#M30180</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T17:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2</title>
      <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383307#M30181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I specified &lt;STRONG&gt;'baseF = os.getcwd()'&lt;/STRONG&gt; first and then added the baseF variable to the glob module, &lt;STRONG&gt;'mxdLst = glob.glob(baseF + '\\' + '*.mxd')'&lt;/STRONG&gt;.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the simplification! It throws the old error where the connection was closed...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But when I make the following change (surround in double quotes):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; inMxd = arcpy.mapping.MapDocument(&lt;STRONG&gt;'\"'&lt;/STRONG&gt; + mxds + &lt;STRONG&gt;'\"'&lt;/STRONG&gt;) #Make current mxd in loop the mapdocument&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(surround in double quotes with 'r' prefix)&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; inMxd = arcpy.mapping.MapDocument(&lt;STRONG&gt;'r\"'&lt;/STRONG&gt; + mxds + &lt;STRONG&gt;'\"'&lt;/STRONG&gt;) #Make current mxd in loop the mapdocument&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I get the invalid mxd name error from pyscripter (it crashed in IDLE):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH]7948[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Looks like the part in red shows it is NOT passing the &lt;/SPAN&gt;&lt;STRONG&gt;os.path.isfile(mxd)&lt;/STRONG&gt;&lt;SPAN&gt; check/test.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;Side question: When I use the 'str' command in the script is it not necessary to import the 'string' module?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2011 17:35:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383307#M30181</guid>
      <dc:creator>DonovanCameron</dc:creator>
      <dc:date>2011-07-27T17:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2</title>
      <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383308#M30182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You will not have to add quotes to the 'mxds' variable.&amp;nbsp; I believe because you are looping through a list that is comprised of strings, and therefore python knows the variable 'mxds' is already a string.&amp;nbsp; Example, you could simply write:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for mxds in mxdLst:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print mxds + " is a map document"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You would not have to write:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for mxds in mxdLst:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print str(mxds) + " is a map document"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In your code, try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;inMxd = arcpy.mapping.MapDocument(mxds) #Make current mxd in loop the mapdocument&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:38:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383308#M30182</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T17:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2</title>
      <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383309#M30183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for all your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This script started from the simplest form as taken from the bottom of this page:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/ExportToPDF/00s300000027000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/ExportToPDF/00s300000027000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

mxd = arcpy.mapping.MapDocument(r"C:\Users\is0009\Desktop\temp\Rural_OCP_map_1_17x11.mxd")

print 'Exporting PDF...'
arcpy.mapping.ExportToPDF(mxd, r"C:\Users\is0009\Desktop\temp\Rural_OCP_map_1_17x11.pdf")
print 'Done exporting!'

del mxd&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The above fails with my original error: &lt;/SPAN&gt;&lt;SPAN style="color:&amp;quot;red&amp;quot;;"&gt;An existing connection was forcibly closed by the remote host.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My license level is ArcView (local) and occasionally I use an ArcEditor concurrent-use when needed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;This is running on a fresh install of windows 7 and arcgis 10 sp2.&lt;BR /&gt;&lt;BR /&gt;Not tested with sp1 or no sp installed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Windows 7 firewall is turned off.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried using all forms of path names from the help: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Setting_paths_to_data_in_Python/002z0000000r000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Setting_paths_to_data_in_Python/002z0000000r000000/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:38:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383309#M30183</guid>
      <dc:creator>DonovanCameron</dc:creator>
      <dc:date>2021-12-11T17:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2</title>
      <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383310#M30184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does your data within your MXDs resides within an SDE geodatabase?&amp;nbsp; If so, can you try this script on an MXD that contains data from a File or Personal geodatabase?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 17:42:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383310#M30184</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2011-07-28T17:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2</title>
      <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383311#M30185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Does your data within your MXDs resides within an SDE geodatabase?&amp;nbsp; If so, can you try this script on an MXD that contains data from a File or Personal geodatabase?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;EDIT:&lt;BR /&gt;Forgot to say that my 'rocp' mxds do have data from shapefiles, gdb, and an sde.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I created some new/blank mxds that all exported fine:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Shapefiles.mxd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FileGDB.mxd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SDE.mxd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;All3.mxd&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Its my "rocp" mxds that fail! They were from 9.3.1 so I opened one and saved it as a copy to version 10; still failed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;OBJECT type="application/x-shockwave-flash" height="355" width="425" data="&amp;lt;/span&amp;gt;&amp;lt;a class=&amp;quot;jive-link-external-small&amp;quot; href=&amp;quot;http://www.youtube.com/v/S8iclZrdp2A"&gt;&lt;PARAM name="movie" value="&amp;lt;/span&amp;gt;&amp;lt;a class=&amp;quot;jive-link-external-small&amp;quot; href=&amp;quot;http://www.youtube.com/v/S8iclZrdp2A" /&gt;&lt;PARAM name="allowScriptAccess" value="sameDomain" /&gt;&lt;PARAM name="quality" value="best" /&gt;&lt;PARAM name="bgcolor" value="#FFFFFF" /&gt;&lt;PARAM name="scale" value="noScale" /&gt;&lt;PARAM name="salign" value="TL" /&gt;&lt;PARAM name="FlashVars" value="playerMode=embedded" /&gt;&lt;PARAM name="wmode" value="transparent" /&gt;&lt;/OBJECT&gt;&lt;BR /&gt;" rel="nofollow" target="_blank"&amp;gt;http://www.youtube.com/watch?v=S8iclZrdp2A[/video]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 18:19:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383311#M30185</guid>
      <dc:creator>DonovanCameron</dc:creator>
      <dc:date>2011-07-28T18:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2</title>
      <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383312#M30186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Let's try recreating the MXD.&amp;nbsp; Open the corrupted MXD and select all the layers within the Table of Contents &amp;gt; right-click on one of the selected layers &amp;gt; Copy.&amp;nbsp; Next, start a new MXD and right-click on the data frame &amp;gt; Paste Layers.&amp;nbsp; Save this MXD with a new name and try exporting to a PDF using your script.&amp;nbsp; Do you still receive the same error?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jul 2011 09:51:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383312#M30186</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2011-07-29T09:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2</title>
      <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383313#M30187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Let's try recreating the MXD.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;will&lt;/SPAN&gt;&lt;SPAN&gt; work, but it may not be feasible given the production method used for these mxd's...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can for example, copy and paste all page layout elements (dataframes, scalebars, images, north arrows and legends with a Ctrl+A, Ctrl+C then a Ctrl+V) successfully into a new blank mxd. But their position and size are lost, sometimes larger or smaller depending on the viewing scale in my layout view. I cannot let this happen, because now I have to go and match the size and position of EVERY layout element to the old values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(I tried grouping everything and then batch re-sizing this single object but some objects don't maintain their respective positions)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Making sure both mxd's are 1:1 in layout mode will help get rid of &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;some&lt;/SPAN&gt;&lt;SPAN&gt; of the scaling issue...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Reference scales are kept, but the map extent changes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The formatting in my legends are lost too, they paste fine and at first - visually they are correct, but when I save and close then re-open the mxd, they default to a "default legend" will ALL the layers in my TOC present, with default symbol/patch properties and export to PDF as such.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My formatting and styles are not kept in the legend...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have to copy and paste the actual dataframes because they contain annotation groups that need to be carried over.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to batch export these because it takes me half a working day just to open &amp;gt; export map &amp;gt; close &amp;gt; open next map...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Any thoughts on if I should be 'upgrading' to 9.3.1?&lt;BR /&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I really enjoy the new look and feel of v10 but some of these minor hiccups cut deep into my day(s) and confuse me especially when I am trying to &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;learn&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; more about arcgis python scripting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;This reminds me of the time when I was younger and went to the hospital to get my cast removed. I was terrified of the doctor with that vibrating saw thingy.&lt;BR /&gt;&lt;BR /&gt;"It won't even cut through paper she says", and places a piece of paper on the bench and turns the saw on at which point it cuts through cleanly.&lt;BR /&gt;&lt;BR /&gt;"Bad example", is all she said and quickly went to work on removing my cast...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Aug 2011 22:42:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383313#M30187</guid>
      <dc:creator>DonovanCameron</dc:creator>
      <dc:date>2011-08-02T22:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2</title>
      <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383314#M30188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sounds like the problem is just with this specific MXD, so I don't think reverting back to 9.3.1 will help.&amp;nbsp; There are a couple other things you can try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&amp;nbsp; Save the MXD to a new MXD (you can even try an earlier version of ArcGIS by using 'Save A Copy')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2.&amp;nbsp; Run the 'ArcGIS Document Defragmenter' on the MXD&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3.&amp;nbsp; Run the 'MXD Doctor' on the MXD&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Both of the utilities mentioned in 2 and 3 are located at Start &amp;gt; Programs &amp;gt; ArcGIS &amp;gt; Desktop Tools.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Aug 2011 11:59:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383314#M30188</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2011-08-03T11:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2</title>
      <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383315#M30189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I use the Title property in the MXD to populate the PDF name in my batch exporting script. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os, sys, string

#overwirte existing PDFs
arcpy.OverWriteOutput = 1

#multimxds = string.split(arcpy.GetParameterAsText(0), ";")
multimxds = [filename[1:-1] for filename in string.split(arcpy.GetParameterAsText(0), ";")]
outputfolder = arcpy.GetParameterAsText(1)

#set variable for PDF name
#trying to set folder path
folderpath = outputfolder

#export to pdf
#trying to export to pdf using title name and folder parameter
for mxdloop in multimxds:
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(mxdloop)
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = mxd.title
&amp;nbsp;&amp;nbsp;&amp;nbsp; pdf = folderpath + '\\' + name + ".pdf"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, pdf, 'PAGE_LAYOUT', 640, 480, 400)

#delete folderpath variable
del folderpath


&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:38:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383315#M30189</guid>
      <dc:creator>JasonHarshman</dc:creator>
      <dc:date>2021-12-11T17:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2</title>
      <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383316#M30190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry I'm a little late to the club. I just posted the script I wrote earlier this year. Simple but does a good job. There is much room for improvement, appreciate any feedback. Hopefully it helps you out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=D8ED73DF-1422-2418-7F74-A6DCBEA9A2EB"&gt;http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=D8ED73DF-1422-2418-7F74-A6DCBEA9A2EB&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Aug 2011 17:12:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383316#M30190</guid>
      <dc:creator>StevenPorter</dc:creator>
      <dc:date>2011-08-17T17:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Errno: 10054 when batch exporting mxd to pdf using arcpy.mapping - ArcGIS 10 SP2</title>
      <link>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383317#M30191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Sorry I'm a little late to the club. I just posted the script I wrote earlier this year. Simple but does a good job. There is much room for improvement, appreciate any feedback. Hopefully it helps you out.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=D8ED73DF-1422-2418-7F74-A6DCBEA9A2EB"&gt;http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=D8ED73DF-1422-2418-7F74-A6DCBEA9A2EB&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Great job. This is very handy indeed!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Update on my little corrupt mxds: the things could not be saved with any mxd doctors so a little copy and pasting of the layouts was done into a new blank mxd then the scripts run fine.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Aug 2011 15:04:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errno-10054-when-batch-exporting-mxd-to-pdf-using/m-p/383317#M30191</guid>
      <dc:creator>DonovanCameron</dc:creator>
      <dc:date>2011-08-22T15:04:55Z</dc:date>
    </item>
  </channel>
</rss>

