<?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: Python not getting pasted correctly in ArcMap in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220501#M17041</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for that tip!&amp;nbsp; hmmm.... my script has been working fine with the single backslashes, so your post makes me wonder why I haven't had problems with that!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Jun 2020 21:23:21 GMT</pubDate>
    <dc:creator>AllenDailey1</dc:creator>
    <dc:date>2020-06-16T21:23:21Z</dc:date>
    <item>
      <title>Python not getting pasted correctly in ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220497#M17037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello there,&lt;/P&gt;&lt;P&gt;I've been working on creating some Python scripts, and I've been testing out parts of them by copying and pasting the code from PyCharm into the Python window in ArcMap.&amp;nbsp; That has worked perfectly for many days, until today.&amp;nbsp; Today, when I've tried copying and pasting this script (which is for undoing some of what my real script does, so that I can re-test it), it gets pasted in an unusual font.&amp;nbsp; I HAVE RUN THIS SCRIPT SUCCESSFULLY BEFORE.&amp;nbsp; But today, it does not seem to be recognized as code.&amp;nbsp; It does not automatically get the dots on the left-hand side of the lines of code that it normally gets.&amp;nbsp; And the code does not run, as you can see in the error message at the bottom.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me get back to the correct style pasting?&amp;nbsp; Why is this happening?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/496823_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 18:32:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220497#M17037</guid>
      <dc:creator>AllenDailey1</dc:creator>
      <dc:date>2020-06-16T18:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Python not getting pasted correctly in ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220498#M17038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure what might be going on in ArcMap, and I don't use pycharm, but can't you run snippets of code from a pycharm console?&amp;nbsp; That's what I like to do with Spyder.&amp;nbsp; Are you using the same .mxd?&amp;nbsp; Maybe try creating a new one?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 19:21:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220498#M17038</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-06-16T19:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Python not getting pasted correctly in ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220499#M17039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/371999"&gt;Allen Dailey&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hmmm, I am not sure, but it doesn't looks like there is any invalid syntax in line 1... "import arcpy", what can be wrong with that?!&lt;/P&gt;&lt;P&gt;I have always been taught, when looking for the error, to also have a look at the line before and/or the line after the one indicated by the parser.&lt;/P&gt;&lt;P&gt;So, let's have a look at line 2, the line where you set the path to your data: you are using backslashes here. And maybe that's what is hurting...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should replace these backslashes either by forward slashes, or by double backslashes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Egge-Jan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More info:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/get-started/setting-paths-to-data.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/get-started/setting-paths-to-data.htm"&gt;Setting paths to data in Python—ArcPy Get Started | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Programming languages, such as Python, treat a backslash (\) as an escape character. For instance, &lt;SPAN class=""&gt;\n&lt;/SPAN&gt; represents a line feed, and &lt;SPAN class=""&gt;\t&lt;/SPAN&gt; represents a tab. When specifying a path, a forward slash ( /) can be used in place of a backslash. Two backslashes can be used instead of one to avoid a syntax error. A string literal can also be used by placing the letter &lt;SPAN class=""&gt;r&lt;/SPAN&gt; before a string containing a backslash so it is interpreted correctly.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 20:32:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220499#M17039</guid>
      <dc:creator>Egge-Jan_Pollé</dc:creator>
      <dc:date>2020-06-16T20:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Python not getting pasted correctly in ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220500#M17040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your suggestions, Joe and Egge-Jan!&lt;/P&gt;&lt;P&gt;I quit and then reopened ArcMap and tried again, and this time the code was pasted normally and it worked.&amp;nbsp; I'd still be quite interested to hear if anyone has an answer to my question, just out of curiosity.&lt;/P&gt;&lt;P&gt;But I guess the moral of the story is: if you have a problem, quit the application and then try again.&amp;nbsp; &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;--Allen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 21:21:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220500#M17040</guid>
      <dc:creator>AllenDailey1</dc:creator>
      <dc:date>2020-06-16T21:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Python not getting pasted correctly in ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220501#M17041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for that tip!&amp;nbsp; hmmm.... my script has been working fine with the single backslashes, so your post makes me wonder why I haven't had problems with that!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 21:23:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220501#M17041</guid>
      <dc:creator>AllenDailey1</dc:creator>
      <dc:date>2020-06-16T21:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: Python not getting pasted correctly in ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220502#M17042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can never remember when to escape a slash, so I like to copy and paste the path out of a catalog pane in pro and use the raw text indicator (r).&amp;nbsp; For example to get an output of field names and types in a tuple format:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;table &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\GIS\Paradox\BUSS\Business.gdb\BusinessLicense'&lt;/SPAN&gt;‍
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; f &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcoy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFields&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;table&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;type&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:45:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220502#M17042</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-11T10:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: Python not getting pasted correctly in ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220503#M17043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh, huh!&amp;nbsp; I've learned from experience that it's necessary to have the "r" in front of the path, but I didn't know what it actually meant or did, so that's a big help to know that it helps prevent unintended escapes due to backslashes!&amp;nbsp; That makes sense.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 22:23:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-not-getting-pasted-correctly-in-arcmap/m-p/220503#M17043</guid>
      <dc:creator>AllenDailey1</dc:creator>
      <dc:date>2020-06-16T22:23:25Z</dc:date>
    </item>
  </channel>
</rss>

