<?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 Re: Create Runtime Content tool in Python script in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220212#M2636</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Maybe someone from &lt;/SPAN&gt;&lt;A class="jivecontainerTT-hover-container jive-link-community-small" data-containerid="2059" data-containertype="14" data-objectid="2145" data-objecttype="14" href="https://community.esri.com/community/developers/gis-developers/python"&gt;https://community.esri.com/community/developers/gis-developers/python&lt;/A&gt;&lt;SPAN&gt; can answer this one?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Nov 2015 11:46:58 GMT</pubDate>
    <dc:creator>AnttiKajanus1</dc:creator>
    <dc:date>2015-11-27T11:46:58Z</dc:date>
    <item>
      <title>Create Runtime Content tool in Python script</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220209#M2633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to automate the process of creating runtime geodatabase. I have a working model which use the Create Runtime Content tool. It works without any errors. &lt;/P&gt;&lt;P&gt;I exported this model to python script and it failed to execute. &lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" height="130" src="https://community.esri.com/legacyfs/online/141923_pastedImage_4.png" style="height: 130px; width: 790.196px;" width="790" /&gt;&lt;/P&gt;&lt;P&gt;So I tried to run that model from toolbox by using arcpy.ImportToolbox and it still wouldn't execute. &lt;/P&gt;&lt;P&gt;If I just copy this line arcpy.CreateRuntimeContent_management("C:\\Jana\\final.mxd", "C:\\Jana\\MobileData", "", "", "DEFAULT", "FEATURE_AND_TABULAR_DATA", "NON_OPTIMIZE_SIZE", "ONLINE", "PNG", "1", "") into python window in ArcCatalog it worked fine without any errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my stand-alone script for running the model:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.ImportToolbox("C:\Jana\Jana.tbx")&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Jana.Content()&lt;/P&gt;&lt;P&gt;except arcpy.ExecuteError:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(arcpy.GetMessages(2))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My toolbox alias is "Jana" and model name (as well as label) is "Content". I have also try to use arcpy.Content_Jana with the same "Failed to execute".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thoughts?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2015 01:53:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220209#M2633</guid>
      <dc:creator>JanaPfefferova</dc:creator>
      <dc:date>2015-11-12T01:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: Create Runtime Content tool in Python script</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220210#M2634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the import toolbox line should have double backslashes, single foreslashes or an r in front of it for raw formatting a single backlash is interpreting the next character as an escape sequence.&amp;nbsp; It is a python thing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2015 02:41:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220210#M2634</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-11-12T02:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create Runtime Content tool in Python script</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220211#M2635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;I have copied wrong version but I had tried also with “r” and with double back slashes and single front slashes before. It’s not causing the issues. The error is the same “Error executing function” no matter which slashes I use.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Nov 2015 19:42:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220211#M2635</guid>
      <dc:creator>JanaPfefferova</dc:creator>
      <dc:date>2015-11-15T19:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Create Runtime Content tool in Python script</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220212#M2636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Maybe someone from &lt;/SPAN&gt;&lt;A class="jivecontainerTT-hover-container jive-link-community-small" data-containerid="2059" data-containertype="14" data-objectid="2145" data-objecttype="14" href="https://community.esri.com/community/developers/gis-developers/python"&gt;https://community.esri.com/community/developers/gis-developers/python&lt;/A&gt;&lt;SPAN&gt; can answer this one?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Nov 2015 11:46:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220212#M2636</guid>
      <dc:creator>AnttiKajanus1</dc:creator>
      <dc:date>2015-11-27T11:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create Runtime Content tool in Python script</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220213#M2637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can see that you're running your code against the 64-bit install of python. I'd be curious to find out if your code works against the 32-bit install of python. I won't be able to test this against the 64-bit install until Monday, but everything works fine on my machine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you try running the attached script? I've included a map package that the code can run against to create the runtime content. I've pasted the code below as well. The code is designed to extract a map document from the map package and use it to create the runtime content.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import subprocess
from os import path, walk

def ExtractMpk(mpkPath):
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFolder = mpkPath.replace(".mpk", "_extracted")
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(outFolder):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.Delete(outFolder)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.ExtractPackage(mpkPath, outFolder)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxdPaths = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for root, dirs, files in walk(outFolder):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for name in files:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if name.endswith(".mxd"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return path.join(root, name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return None

def ValidateMxd(mxdPath, filler="Test"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(mxdPath)
&amp;nbsp;&amp;nbsp;&amp;nbsp; empty = (None, "", " ")
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; for attr in ("author", "credits", "description", "summary", "tags", "title"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if getattr(mxd, attr).strip() in empty:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setattr(mxd, attr, filler)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; naLayer = False&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; for df in arcpy.mapping.ListDataFrames(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if df.description.strip() in empty:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; df.description = filler
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for lyr in arcpy.mapping.ListLayers(mxd, data_frame=df):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.description.strip() in empty:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.description = filler
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.isNetworkAnalystLayer:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; naLayer = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.save()
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return naLayer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
def CreateRtContent(mxdPath, naLayer=False):
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFolder = mxdPath.replace(".mxd", "_rtc")
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(outFolder):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.Delete(outFolder)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; params = {"extent":"MAXOF", "optimize":"NON_OPTIMIZE_SIZE", "options":"FEATURE_AND_TABULAR_DATA"}&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; if naLayer: params["options"].extend(["NETWORK_DATA"])
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.CreateRuntimeContent(mxdPath, outFolder, **params)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Open the folder where the runtime content is created.
&amp;nbsp;&amp;nbsp;&amp;nbsp; subprocess.Popen("explorer {0}".format(outFolder))

if __name__ == "__main__":
&amp;nbsp;&amp;nbsp;&amp;nbsp; srcPath = path.dirname(__file__)
&amp;nbsp;&amp;nbsp;&amp;nbsp; mpkPath = path.join(srcPath, "MapPackage.mpk")
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Extract the included map package
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxdPath = ExtractMpk(mpkPath)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Validate the map document
&amp;nbsp;&amp;nbsp;&amp;nbsp; naLayer = ValidateMxd(mxdPath)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create Runtime Content
&amp;nbsp;&amp;nbsp;&amp;nbsp; CreateRtContent(mxdPath, naLayer)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:44:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220213#M2637</guid>
      <dc:creator>FreddieGibson</dc:creator>
      <dc:date>2021-12-11T10:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create Runtime Content tool in Python script</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220214#M2638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Freddie,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You’re right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have installed pywin32 (32 bit) and it works. It also works in pyscripter but I needed pywin to be able to automate it in task scheduler.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Nov 2015 23:47:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220214#M2638</guid>
      <dc:creator>JanaPfefferova</dc:creator>
      <dc:date>2015-11-29T23:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create Runtime Content tool in Python script</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220215#M2639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In task scheduler are you explicitly setting the 32 bit python executable to run your script or are you using the default for the system? I would highly suggest that you explicitly set the python executable if your default isn't the 32bit instance. I'm assuming the default on your machine is the 64 bit instance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Nov 2015 08:31:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220215#M2639</guid>
      <dc:creator>FreddieGibson</dc:creator>
      <dc:date>2015-11-30T08:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Create Runtime Content tool in Python script</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220216#M2640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm explicitly setting the 32 bit python to run it. It didn't work with the default 64 bit instance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Nov 2015 19:34:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/create-runtime-content-tool-in-python-script/m-p/220216#M2640</guid>
      <dc:creator>JanaPfefferova</dc:creator>
      <dc:date>2015-11-30T19:34:21Z</dc:date>
    </item>
  </channel>
</rss>

