<?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: Pycharm and ArcGIS Pro compatibility: scripts work in Python window but not in Pycharm in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225496#M17433</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Change the following two lines:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;res &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'taxlots'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'NEW_SELECTION'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; query&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CopyFeatures_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;res&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; outFC_temp&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jan 2020 17:56:25 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2020-01-15T17:56:25Z</dc:date>
    <item>
      <title>Pycharm and ArcGIS Pro compatibility: scripts work in Python window but not in Pycharm</title>
      <link>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225488#M17425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there, I've installed PyCharm as per the the ESRI course "Python for Everyone" and was able to get through the entire course without problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I try to run a script I am starting to write on Pycharm, though it runs with no errors, I am getting odd results. I test the script statements in Python window and am able to get the results I am expecting, but when I run them through Pycharm I get a completely different result.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can somebody help me with this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the simple piece of code I am running:&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;arcpy
&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;os

workspace = &lt;SPAN style="color: #6a8759;"&gt;r'C:\Users\paperspace\Google Drive\QTA\19010_PDX Zoning\PDXZoning\PDXZoning.gdb'
&lt;/SPAN&gt;outWorkspace = &lt;SPAN style="color: #6a8759;"&gt;r'C:\Users\paperspace\Google Drive\QTA\19010_PDX Zoning\PDXZoning\PDXZoned.gdb'
&lt;/SPAN&gt;arcpy.env.workspace = workspace

&lt;SPAN style="color: #808080;"&gt;# set the target address taxlot
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# consider capitalizing whatever user inputs
&lt;/SPAN&gt;address = &lt;SPAN style="color: #6a8759;"&gt;"1519 SE MORRISON ST"
&lt;/SPAN&gt;field = arcpy.AddFieldDelimiters(&lt;SPAN style="color: #6a8759;"&gt;'taxlots'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;'SITEADDR'&lt;/SPAN&gt;)
query = field + &lt;SPAN style="color: #6a8759;"&gt;" LIKE '%" &lt;/SPAN&gt;+ address + &lt;SPAN style="color: #6a8759;"&gt;"%'"
&lt;/SPAN&gt;&lt;SPAN style="color: #8888c6;"&gt;print&lt;/SPAN&gt;(query)

&lt;SPAN style="color: #808080;"&gt;# select the target taxlot
&lt;/SPAN&gt;arcpy.SelectLayerByAttribute_management(&lt;SPAN style="color: #6a8759;"&gt;'taxlots'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;'NEW_SELECTION'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;query)

&lt;SPAN style="color: #808080;"&gt;# test output--you can remove this once done testing
&lt;/SPAN&gt;outFC_temp = os.path.join(outWorkspace&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;'tempARE09'&lt;/SPAN&gt;)
&lt;SPAN style="color: #cc7832;"&gt;if &lt;/SPAN&gt;arcpy.Exists(outFC_temp):
    arcpy.Delete_management(outFC_temp)
arcpy.CopyFeatures_management(&lt;SPAN style="color: #6a8759;"&gt;'taxlots'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;outFC_temp)&lt;/PRE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;When I copy and paste into Python Window, I get the result I am expecting, which is the selection of a specific taxlot in a cadastral map with the SQL query.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run this same script in Pycharm, the script runs fine, but gives me a completely different result (a different taxlot, strangely). Other geoprocessing commands don't seem to do anything, either.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't tell if I am passing the SQL query incorrectly, writing the output file incorrectly, or if I have incorrectly pointed to the correct Python interpreter. However, the script works fine in Python Window and&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my Pycharm interpreter, which I believe is pointing to the right spot:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/478354_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;However, when I double click on the executable from explorer I get this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/478367_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;Which seems weird to me but everything else seems to run fine.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:59:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225488#M17425</guid>
      <dc:creator>QuangTruong</dc:creator>
      <dc:date>2021-12-11T10:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Pycharm and ArcGIS Pro compatibility: scripts work in Python window but not in Pycharm</title>
      <link>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225489#M17426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are many unclosed links relating to pycharm....&lt;/P&gt;&lt;P&gt;promising&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/219641"&gt;Can ArcGIS Pro integrate with JetBrains Pycharm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;others&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/forums/searchpage/tab/message?q=pycharm&amp;amp;after=year"&gt;https://community.esri.com/search.jspa?q=pycharm&amp;amp;after=year&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you aren't stuck on pycharm&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2018/12/13/spyder"&gt;/blogs/dan_patterson/2018/12/13/spyder&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and when Pro 2.5 comes out, I have been using&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2019/12/12/spyder-4-the-python-ide-for-science"&gt;/blogs/dan_patterson/2019/12/12/spyder-4-the-python-ide-for-science&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2020 18:44:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225489#M17426</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-01-14T18:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Pycharm and ArcGIS Pro compatibility: scripts work in Python window but not in Pycharm</title>
      <link>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225490#M17427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Regarding:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;when I double click on the executable from explorer ....&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Don't.&amp;nbsp; The ArcGIS Pro installer creates a shortcut for properly activating the conda environment.&amp;nbsp; Running the Python executable the way you describe will eventually run into issues.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2020 19:25:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225490#M17427</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-01-14T19:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Pycharm and ArcGIS Pro compatibility: scripts work in Python window but not in Pycharm</title>
      <link>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225491#M17428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not stuck on Pycharm, I just used it because it was recommended by the ESRI "Python for Everyone" course, and it had a well detailed installation setup to integrate with ArcGIS. I've followed the instructions on the link provided in your link, and it seems to be set up correctly, but the problem persists.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2020 19:41:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225491#M17428</guid>
      <dc:creator>QuangTruong</dc:creator>
      <dc:date>2020-01-14T19:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: Pycharm and ArcGIS Pro compatibility: scripts work in Python window but not in Pycharm</title>
      <link>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225492#M17429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I only did so at the recommendation of another discussion thread related to the same topic to troubleshoot. Thanks for the advice.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2020 19:43:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225492#M17429</guid>
      <dc:creator>QuangTruong</dc:creator>
      <dc:date>2020-01-14T19:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: Pycharm and ArcGIS Pro compatibility: scripts work in Python window but not in Pycharm</title>
      <link>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225493#M17430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you run code in PyCharm, it runs it in a separate process so it is not aware of any layers or table views you have created in the application if it is open.&amp;nbsp; In the code snippet you provided, you are referencing a layer that you never create ('taxlots').&amp;nbsp; If the workspace is set to a folder or geodatabase that has a data set named 'taxlots', the Select Layer tool will work because it will take the data set instead of a layer, and it will create a new layer.&amp;nbsp; The newly created layer has a different name than the data set.&amp;nbsp; Given your code, I suspect it is simply copying the entire 'taxlots' data set when run via PyCharm.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2020 20:04:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225493#M17430</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-01-14T20:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: Pycharm and ArcGIS Pro compatibility: scripts work in Python window but not in Pycharm</title>
      <link>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225494#M17431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Strangely, what it's doing is selecting one (1) taxlot in the 'taxlots' feature class in the geodatabase, just not the one that I was hoping for with my SQL query! When I copy paste the exact same code in the Python window, it works exactly as expected. So why it would be different is confounding me.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2020 20:30:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225494#M17431</guid>
      <dc:creator>QuangTruong</dc:creator>
      <dc:date>2020-01-14T20:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: Pycharm and ArcGIS Pro compatibility: scripts work in Python window but not in Pycharm</title>
      <link>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225495#M17432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, Joshua, you were right. I found out that my featureclass was corrupted, so what I was trying to select for wasn't possible. However, it is now doing what Joshua suspected, which is just copying the entire 'taxlots' dataset. How do I get it to only copy a selection?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2020 00:19:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225495#M17432</guid>
      <dc:creator>QuangTruong</dc:creator>
      <dc:date>2020-01-15T00:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Pycharm and ArcGIS Pro compatibility: scripts work in Python window but not in Pycharm</title>
      <link>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225496#M17433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Change the following two lines:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;res &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'taxlots'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'NEW_SELECTION'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; query&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CopyFeatures_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;res&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; outFC_temp&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2020 17:56:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225496#M17433</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-01-15T17:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Pycharm and ArcGIS Pro compatibility: scripts work in Python window but not in Pycharm</title>
      <link>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225497#M17434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, yes, that makes sense. I knew it was something simple. Thank you.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2020 21:15:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225497#M17434</guid>
      <dc:creator>QuangTruong</dc:creator>
      <dc:date>2020-01-15T21:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Pycharm and ArcGIS Pro compatibility: scripts work in Python window but not in Pycharm</title>
      <link>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225498#M17435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If my response resolved the issue, please mark it correct to close out the question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2020 00:23:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pycharm-and-arcgis-pro-compatibility-scripts-work/m-p/225498#M17435</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-01-16T00:23:54Z</dc:date>
    </item>
  </channel>
</rss>

