<?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: Extracting mpk fails while executing as a GP Service in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/extracting-mpk-fails-while-executing-as-a-gp/m-p/422584#M14246</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The best thing to do would be to register a folder where the map packages will be located with ArcGIS Server.&amp;nbsp; But, to answer your question, I think you have path issue.&amp;nbsp; Try changing this line: &lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; background-color: #d9ead3;"&gt;arcpy.ExtractPackage_management(wrksp + "/J6.mpk", "J6")&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;to this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; background-color: #d9ead3;"&gt;import os&lt;/SPAN&gt;
&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; background-color: #d9ead3;"&gt;arcpy.ExtractPackage_management(wrksp + os.sep + "J6.mpk", "J6")&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 19:05:23 GMT</pubDate>
    <dc:creator>AndrewKeith3</dc:creator>
    <dc:date>2021-12-11T19:05:23Z</dc:date>
    <item>
      <title>Extracting mpk fails while executing as a GP Service</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/extracting-mpk-fails-while-executing-as-a-gp/m-p/422583#M14245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;DIV&gt;Hi,&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;We have a custom tool to extract an mpk file to a specific location.&lt;/DIV&gt;Below is the python code we used to extract the mpk file:&lt;BR /&gt;&lt;SPAN style="background-color: #d9ead3;"&gt;import arcpy&lt;BR /&gt;import os&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="background-color: #d9ead3;"&gt;&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;BR /&gt;# set folder that contains packages to extract&lt;BR /&gt;arcpy.env.workspace = "N:/geoprocessing"&lt;BR /&gt;wrksp = arcpy.env.workspace&lt;BR /&gt;&lt;BR /&gt;arcpy.AddMessage("wrksp : " + wrksp )&lt;BR /&gt;arcpy.ExtractPackage_management(wrksp + "/J6.mpk", "J6")&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;While executing this script as a tool in ArcMap, it is executing successfully with the following message:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;EM style="background-color: #d9ead3;"&gt;Running script extract...&lt;BR /&gt;wrksp : &lt;STRONG&gt;N:/geoprocessing&lt;/STRONG&gt;&lt;BR /&gt;Completed script extract...&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once we made this as a GP service and access it via browser,&amp;nbsp; it fails. Following is the message retrieved:&lt;BR /&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;EM style="background-color: #d9ead3;"&gt;esriJobMessageTypeInformative: Running script extract...&lt;BR /&gt;esriJobMessageTypeInformative: wrksp : &lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt;D:\arcgisserver\directories\arcgissystem\arcgisinput\test_extract.GPServer\extracted\v101&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;esriJobMessageTypeInformative: Failed script extract...&lt;BR /&gt;esriJobMessageTypeError: Traceback (most recent call last): File "D:\arcgisserver\directories\arcgissystem\arcgisinput\test_extract.GPServer\extracted\v101\my_toolboxes\module1.py", line 31, in arcpy.ExtractPackage_management(wrksp + "/J6.mpk", g_ESRI_variable_1) File "c:\program files\arcgis\server\arcpy\arcpy\management.py", line 7383, in ExtractPackage raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Package: Dataset D:\arcgisserver\directories\arcgissystem\arcgisinput\test_extract.GPServer\extracted\v101/J6.mpk does not exist or is not supported Failed to execute (ExtractPackage).&lt;BR /&gt;esriJobMessageTypeError: Failed to execute (extract).&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;We could see that the application is not able to detect the workspace while running as GP tool. Also, the workspace we used here is a mapped Network path. I tried even by changing this to C drive. That also fails.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help regarding this is appreciable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2016 18:25:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/extracting-mpk-fails-while-executing-as-a-gp/m-p/422583#M14245</guid>
      <dc:creator>Jose_FrancisK_J</dc:creator>
      <dc:date>2016-03-30T18:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting mpk fails while executing as a GP Service</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/extracting-mpk-fails-while-executing-as-a-gp/m-p/422584#M14246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The best thing to do would be to register a folder where the map packages will be located with ArcGIS Server.&amp;nbsp; But, to answer your question, I think you have path issue.&amp;nbsp; Try changing this line: &lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; background-color: #d9ead3;"&gt;arcpy.ExtractPackage_management(wrksp + "/J6.mpk", "J6")&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;to this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; background-color: #d9ead3;"&gt;import os&lt;/SPAN&gt;
&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; background-color: #d9ead3;"&gt;arcpy.ExtractPackage_management(wrksp + os.sep + "J6.mpk", "J6")&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:05:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/extracting-mpk-fails-while-executing-as-a-gp/m-p/422584#M14246</guid>
      <dc:creator>AndrewKeith3</dc:creator>
      <dc:date>2021-12-11T19:05:23Z</dc:date>
    </item>
  </channel>
</rss>

