Pretty straight forward script to build a .tpk from an existing .mxd that contains the desired feature class. In fact, when the ArcToolbox is run on the same .mxd it completes as expected. When I copy and paste the script from the Geoprocessing results window into a standalone .py script, it fails with the below error:
arcpy<SPAN class="punctuation token">.</SPAN>CreateMapTilePackage_management<SPAN class="punctuation token">(</SPAN>in_map<SPAN class="operator token">=</SPAN><SPAN class="string token">"H:/directory/somename.mxd"</SPAN><SPAN class="punctuation token">,</SPAN> service_type<SPAN class="operator token">=</SPAN><SPAN class="string token">"ONLINE"</SPAN><SPAN class="punctuation token">,</SPAN> output_file<SPAN class="operator token">=</SPAN><SPAN class="string token">"H:/directory/somename.tpk"</SPAN><SPAN class="punctuation token">,</SPAN> format_type<SPAN class="operator token">=</SPAN><SPAN class="string token">"PNG"</SPAN><SPAN class="punctuation token">,</SPAN> level_of_detail<SPAN class="operator token">=</SPAN><SPAN class="string token">"10"</SPAN><SPAN class="punctuation token">,</SPAN> service_file<SPAN class="operator token">=</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> summary<SPAN class="operator token">=</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> tags<SPAN class="operator token">=</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> extent<SPAN class="operator token">=</SPAN><SPAN class="string token">"DEFAULT"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
Traceback (most recent call last):
File "<string>", line 73, in execInThread
File "C:\Program Files\PyScripter\Lib\rpyc.zip\rpyc\core\netref.py", line 196, in __call__
File "C:\Program Files\PyScripter\Lib\rpyc.zip\rpyc\core\netref.py", line 71, in syncreq
File "C:\Program Files\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py", line 431, in sync_request
File "C:\Program Files\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py", line 379, in serve
File "C:\Program Files\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py", line 337, in _recv
File "C:\Program Files\PyScripter\Lib\rpyc.zip\rpyc\core\channel.py", line 50, in recv
File "C:\Program Files\PyScripter\Lib\rpyc.zip\rpyc\core\stream.py", line 166, in read
EOFError: [Errno 10054] An existing connection was forcibly closed by the remote host