<?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 arcpy.ImportToolbox('..Data Management Tools.tbx') fails with SP4 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-importtoolbox-data-management-tools-tbx/m-p/442229#M34623</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi folks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this problem started with install of SP4, I'd rather try and fix it than uninstall everything to try and get off SP4.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried reinstalling SP4&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; arcpy.ImportToolbox(r"C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Data Management Tools.tbx")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; File "&amp;lt;interactive input&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\__init__.py", line 94, in ImportToolbox&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; return import_toolbox(input_file, module_name)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\toolbox_code.py", line 411, in import_toolbox&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; mymodule = generate_toolbox_module(toolbox, None, False, False, False, module_name)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\toolbox_code.py", line 389, in generate_toolbox_module&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; mycode = compile(code.encode('utf-8'), toolbox.pathName, 'exec')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; File "C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Data Management Tools.tbx", line 3976&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; """MakeFeatureLayer_management(in_features, out_layer, {where_clause}, {workspace}, {field_info})&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Creates a feature layer from an input feature class or layer file. The layer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; that is created by the tool is temporary and will not persist after the session&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ends unless the layer is saved to disk or the map document is saved.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; INPUTS:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; in_features (Feature Layer):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; The input feature class or layer used the make the new layer. Complex feature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; classes, such as annotation and dimensions, are not valid inputs to this tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; where_clause {SQL Expression}:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; An SQL expression used to select a subset of features. The syntax for the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; expression differs slightly depending on the data source. For example, if you're&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; querying file or ArcSDE geodatabases, shapefiles, or coverages, enclose field&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; names in double quotes: "MY_FIELD" If you're querying personal geodatabases,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; enclose fields in square brackets: [MY_FIELD] In Python, strings are enclosed in&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; matching single or double quotes. To create&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; a string that contains quotes (as is common with a WHERE clause in SQL&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; expressions), you can escape the quotes (using a backslash) or triple quote the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; string. For example, if the intended WHERE clause is "CITY_NAME" = 'Chicago'you&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; could enclose the entire string in double quotes, then escape the interior&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; double quotes like this: " \"CITY_NAME\" = 'Chicago' " Or you could enclose the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; entire string in single quotes, then escape the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; interior single quotes like this: ' "CITY_NAME" = \'Chicago\' 'Or you could&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; enclose the entire string in triple quotes without escaping: """ "CITY_NAME" =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ^&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SyntaxError: invalid syntax&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 May 2012 16:00:01 GMT</pubDate>
    <dc:creator>StevenHaslemore</dc:creator>
    <dc:date>2012-05-02T16:00:01Z</dc:date>
    <item>
      <title>arcpy.ImportToolbox('..Data Management Tools.tbx') fails with SP4</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-importtoolbox-data-management-tools-tbx/m-p/442229#M34623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi folks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this problem started with install of SP4, I'd rather try and fix it than uninstall everything to try and get off SP4.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried reinstalling SP4&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; arcpy.ImportToolbox(r"C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Data Management Tools.tbx")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; File "&amp;lt;interactive input&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\__init__.py", line 94, in ImportToolbox&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; return import_toolbox(input_file, module_name)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\toolbox_code.py", line 411, in import_toolbox&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; mymodule = generate_toolbox_module(toolbox, None, False, False, False, module_name)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\toolbox_code.py", line 389, in generate_toolbox_module&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; mycode = compile(code.encode('utf-8'), toolbox.pathName, 'exec')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; File "C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Data Management Tools.tbx", line 3976&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; """MakeFeatureLayer_management(in_features, out_layer, {where_clause}, {workspace}, {field_info})&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Creates a feature layer from an input feature class or layer file. The layer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; that is created by the tool is temporary and will not persist after the session&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ends unless the layer is saved to disk or the map document is saved.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; INPUTS:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; in_features (Feature Layer):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; The input feature class or layer used the make the new layer. Complex feature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; classes, such as annotation and dimensions, are not valid inputs to this tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; where_clause {SQL Expression}:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; An SQL expression used to select a subset of features. The syntax for the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; expression differs slightly depending on the data source. For example, if you're&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; querying file or ArcSDE geodatabases, shapefiles, or coverages, enclose field&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; names in double quotes: "MY_FIELD" If you're querying personal geodatabases,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; enclose fields in square brackets: [MY_FIELD] In Python, strings are enclosed in&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; matching single or double quotes. To create&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; a string that contains quotes (as is common with a WHERE clause in SQL&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; expressions), you can escape the quotes (using a backslash) or triple quote the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; string. For example, if the intended WHERE clause is "CITY_NAME" = 'Chicago'you&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; could enclose the entire string in double quotes, then escape the interior&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; double quotes like this: " \"CITY_NAME\" = 'Chicago' " Or you could enclose the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; entire string in single quotes, then escape the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; interior single quotes like this: ' "CITY_NAME" = \'Chicago\' 'Or you could&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; enclose the entire string in triple quotes without escaping: """ "CITY_NAME" =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ^&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SyntaxError: invalid syntax&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 16:00:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-importtoolbox-data-management-tools-tbx/m-p/442229#M34623</guid>
      <dc:creator>StevenHaslemore</dc:creator>
      <dc:date>2012-05-02T16:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ImportToolbox('..Data Management Tools.tbx') fails with SP4</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-importtoolbox-data-management-tools-tbx/m-p/442230#M34624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Never tried importing built ins, not sure what the reason you would want to do that is. For what it is worth, the problem is in SP3 as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Test Code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy import os toolDir = r"C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes" for file in os.listdir(toolDir):&amp;nbsp; box = os.path.join(toolDir,file)&amp;nbsp; try: &amp;nbsp; arcpy.ImportToolbox(box)&amp;nbsp; except: &amp;nbsp; print "Error found in "+file &amp;nbsp; pass&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Output&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;lt;module '3d' (built-in)&amp;gt; &amp;lt;module 'analysis' (built-in)&amp;gt; &amp;lt;module 'ArcPad' (built-in)&amp;gt; &amp;lt;module 'cartography' (built-in)&amp;gt; Error found in Conversion Tools.tbx &amp;lt;module 'arc' (built-in)&amp;gt; &amp;lt;module 'interop' (built-in)&amp;gt; Error found in Data Management Tools.tbx &amp;lt;module 'edit' (built-in)&amp;gt; &amp;lt;module 'geocoding' (built-in)&amp;gt; &amp;lt;module 'ga' (built-in)&amp;gt; &amp;lt;module 'lr' (built-in)&amp;gt; &amp;lt;module 'md' (built-in)&amp;gt; &amp;lt;module 'na' (built-in)&amp;gt; &amp;lt;module 'fabric' (built-in)&amp;gt; &amp;lt;module 'samples' (built-in)&amp;gt; &amp;lt;module 'schematics' (built-in)&amp;gt; &amp;lt;module 'server' (built-in)&amp;gt; &amp;lt;module 'sa' (built-in)&amp;gt; &amp;lt;module 'stats' (built-in)&amp;gt; Error found in toolbox.lic &amp;lt;module 'ta' (built-in)&amp;gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So looks like problem importing Conversion and Data Management Toolboxes.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 16:22:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-importtoolbox-data-management-tools-tbx/m-p/442230#M34624</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-05-02T16:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ImportToolbox('..Data Management Tools.tbx') fails with SP4</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-importtoolbox-data-management-tools-tbx/m-p/442231#M34625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply Mathew,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hadn't realised that import was redundant, maybe a hangover from an older approach.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Either way, thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Steven&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 17:03:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-importtoolbox-data-management-tools-tbx/m-p/442231#M34625</guid>
      <dc:creator>StevenHaslemore</dc:creator>
      <dc:date>2012-05-02T17:03:51Z</dc:date>
    </item>
  </channel>
</rss>

