<?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: Why do these two lines of python code fail when I can run them separately with success? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/why-do-these-two-lines-of-python-code-fail-when-i/m-p/367497#M16119</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No it was not. However, I have now tried with it imported and it gives the same result. However, if I was missing a reference, I shouldn't have had any luck when I run the example on line at a time...&lt;IMG alt="Screenshot of the code not working" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/286095_Screenshot.png" style="width: 620px; height: 348px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 18 Dec 2016 20:35:29 GMT</pubDate>
    <dc:creator>Arild_MJohannessen</dc:creator>
    <dc:date>2016-12-18T20:35:29Z</dc:date>
    <item>
      <title>Why do these two lines of python code fail when I can run them separately with success?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/why-do-these-two-lines-of-python-code-fail-when-i/m-p/367493#M16115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When&amp;nbsp;I write these two lines in ArcGIS Pro v1.3.1 Python window I get the result shown below the dotted line.&amp;nbsp;However if I run them one at a time I get the anticipated result. What is going on? By the way, the lines are part of a bigger project, and it seems like anything inserted in line 2 yields an error. I don't suspect that the GPX file is corrupted since it runs with success in example 2 below. It also runs with success with the GPXtoFeatures tool in ArcGIS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.GPXtoFeatures_conversion("D:\Downloads\TrackLog2.gpx", "in_memory/GPX")&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;print("HelloWorld")&lt;/STRONG&gt;&lt;BR /&gt;-----------------------------------------------------------------------------&lt;BR /&gt;Runtime error &lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt; File "&amp;lt;string&amp;gt;", line 2, in &amp;lt;module&amp;gt;&lt;BR /&gt;AttributeError: 'NoneType' object has no attribute 'write'&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.GPXtoFeatures_conversion("D:\Downloads\TrackLog2.gpx", "in_memory/GPX")&lt;/STRONG&gt;&lt;BR /&gt;-----------------------------------------------------------------------------&lt;BR /&gt;&amp;lt;Result 'D:\\ArcGIS Projects\\Test\\Test.gdb\\GPX29'&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;print("HelloWorld")&lt;/STRONG&gt;&lt;BR /&gt;-----------------------------------------------------------------------------&lt;BR /&gt;HelloWorld&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Dec 2016 10:49:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/why-do-these-two-lines-of-python-code-fail-when-i/m-p/367493#M16115</guid>
      <dc:creator>Arild_MJohannessen</dc:creator>
      <dc:date>2016-12-18T10:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why do these two lines of python code fail when I can run them separately with success?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/why-do-these-two-lines-of-python-code-fail-when-i/m-p/367494#M16116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try raw formatting your inputs if you are using command line... ie r"your path goes here preferably without spaces"&lt;/P&gt;&lt;P&gt;having paths beginning with 'n', 't' etc raises the possibility of the \n sequence (for example) being treated as an escape character (in this case a new line)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Dec 2016 15:13:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/why-do-these-two-lines-of-python-code-fail-when-i/m-p/367494#M16116</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-12-18T15:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Why do these two lines of python code fail when I can run them separately with success?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/why-do-these-two-lines-of-python-code-fail-when-i/m-p/367495#M16117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Same result &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/sad.png" /&gt;&amp;nbsp;Is this a bug in ArcGIS Pro? The code runs in ArcGIS Desktop 10.4. Can anyone try to reproduce the error?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.GPXtoFeatures_conversion(r"D:\Downloads\TrackLog2.gpx", r"in_memory/GPX")&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;print(r"HelloWorld")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Runtime error &lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt; File "&amp;lt;string&amp;gt;", line 2, in &amp;lt;module&amp;gt;&lt;BR /&gt;AttributeError: 'NoneType' object has no attribute 'write'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Dec 2016 18:53:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/why-do-these-two-lines-of-python-code-fail-when-i/m-p/367495#M16117</guid>
      <dc:creator>Arild_MJohannessen</dc:creator>
      <dc:date>2016-12-18T18:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Why do these two lines of python code fail when I can run them separately with success?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/why-do-these-two-lines-of-python-code-fail-when-i/m-p/367496#M16118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;arcpy was imported I assume? like in the example&amp;nbsp;&amp;nbsp;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/conversion/gpx-to-features.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/conversion/gpx-to-features.htm"&gt;GPX To Features—Conversion toolbox | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Dec 2016 20:19:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/why-do-these-two-lines-of-python-code-fail-when-i/m-p/367496#M16118</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-12-18T20:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Why do these two lines of python code fail when I can run them separately with success?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/why-do-these-two-lines-of-python-code-fail-when-i/m-p/367497#M16119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No it was not. However, I have now tried with it imported and it gives the same result. However, if I was missing a reference, I shouldn't have had any luck when I run the example on line at a time...&lt;IMG alt="Screenshot of the code not working" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/286095_Screenshot.png" style="width: 620px; height: 348px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Dec 2016 20:35:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/why-do-these-two-lines-of-python-code-fail-when-i/m-p/367497#M16119</guid>
      <dc:creator>Arild_MJohannessen</dc:creator>
      <dc:date>2016-12-18T20:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Why do these two lines of python code fail when I can run them separately with success?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/why-do-these-two-lines-of-python-code-fail-when-i/m-p/367498#M16120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;well the only thing I can test is the 2nd line... which works.&lt;/P&gt;&lt;P&gt;Check for the existence of the file which I presume it is there since the first incarnation works.&lt;/P&gt;&lt;P&gt;Which leaves&amp;nbsp;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/help/analysis/geoprocessing/modelbuilder/the-in-memory-workspace.htm" title="https://pro.arcgis.com/en/pro-app/help/analysis/geoprocessing/modelbuilder/the-in-memory-workspace.htm"&gt;The in_memory workspace—ArcGIS Pro | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;looks ok on the surface, but there are a whole load of errors associated with it and stuff in PRO&amp;nbsp;&lt;A class="link-titled" href="https://desktop.arcgis.com/search/?q=in-memory&amp;amp;collection=all&amp;amp;product=arcgis-pro&amp;amp;version=pro1.3&amp;amp;language=en" title="https://desktop.arcgis.com/search/?q=in-memory&amp;amp;collection=all&amp;amp;product=arcgis-pro&amp;amp;version=pro1.3&amp;amp;language=en"&gt;Search Result | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so that leaves... trying to save it elsewhere.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Dec 2016 20:52:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/why-do-these-two-lines-of-python-code-fail-when-i/m-p/367498#M16120</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-12-18T20:52:40Z</dc:date>
    </item>
  </channel>
</rss>

