<?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 r'&amp;nbsp; Raw String Suppress Escape not working in arcpy ArcGIS 10 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/r-nbsp-raw-string-suppress-escape-not-working-in/m-p/355491#M27939</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm converting all my 9.3.1 python scripts to 10.0 sp1 arcpy scripts and getting fatal crashes in IDLE when I use the r raw string when defining constants which worked fine in the 9.3.1 gp.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Example: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Layers = r'Road Centerline'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Scales = r'2000;900'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;All = r'Recreate All Tiles'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ManageMapServerCacheTiles_server("server","BaseCache/RoadCache", "Layers", Layers, Scales, All.......etc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After I changed the constants to replace r with " it worked&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Layers = "'Road Centerline'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Scales = "'2000;900'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;All = "'Recreate All Tiles'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've used r for years with python and had no problems in the past.&amp;nbsp; It was a habit and am now having to change all references of r when used in an arcpy call.&amp;nbsp; The r still works with python functions such as open(r'C:\GIS Scripts\RoadCacheLog.txt', 'a')&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Has arcpy been designed not to accept the r now?&amp;nbsp; because it worked with gp!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Apr 2011 11:31:04 GMT</pubDate>
    <dc:creator>MikeMeeks</dc:creator>
    <dc:date>2011-04-20T11:31:04Z</dc:date>
    <item>
      <title>r'  Raw String Suppress Escape not working in arcpy ArcGIS 10</title>
      <link>https://community.esri.com/t5/python-questions/r-nbsp-raw-string-suppress-escape-not-working-in/m-p/355491#M27939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm converting all my 9.3.1 python scripts to 10.0 sp1 arcpy scripts and getting fatal crashes in IDLE when I use the r raw string when defining constants which worked fine in the 9.3.1 gp.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Example: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Layers = r'Road Centerline'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Scales = r'2000;900'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;All = r'Recreate All Tiles'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ManageMapServerCacheTiles_server("server","BaseCache/RoadCache", "Layers", Layers, Scales, All.......etc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After I changed the constants to replace r with " it worked&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Layers = "'Road Centerline'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Scales = "'2000;900'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;All = "'Recreate All Tiles'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've used r for years with python and had no problems in the past.&amp;nbsp; It was a habit and am now having to change all references of r when used in an arcpy call.&amp;nbsp; The r still works with python functions such as open(r'C:\GIS Scripts\RoadCacheLog.txt', 'a')&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Has arcpy been designed not to accept the r now?&amp;nbsp; because it worked with gp!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 11:31:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/r-nbsp-raw-string-suppress-escape-not-working-in/m-p/355491#M27939</guid>
      <dc:creator>MikeMeeks</dc:creator>
      <dc:date>2011-04-20T11:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: r'  Raw String Suppress Escape not working in arcpy ArcGIS 10</title>
      <link>https://community.esri.com/t5/python-questions/r-nbsp-raw-string-suppress-escape-not-working-in/m-p/355492#M27940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If the singlequotes are supposed to be literal parts of the string then yes they'll have to be enclosed in double-quotes or escaped a backslash (with no raw string specifier).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Take a look at the Python lexical analysis doc: &lt;/SPAN&gt;&lt;A href="http://docs.python.org/release/2.6.5/reference/lexical_analysis.html#literals"&gt;http://docs.python.org/release/2.6.5/reference/lexical_analysis.html#literals&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is how short strings (non-triple-quoted strings) are defined: &lt;/SPAN&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;STRONG&gt;shortstring&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ::=&amp;nbsp; "'" shortstringitem* "'" | '"' shortstringitem* '"'&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So you have to enclose strings in either double quotes or single quotes, and since you want singlequotes in your string, enclose it with double quotes so you don't have to escape the singlequotes.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 16:33:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/r-nbsp-raw-string-suppress-escape-not-working-in/m-p/355492#M27940</guid>
      <dc:creator>LoganPugh</dc:creator>
      <dc:date>2011-04-20T16:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: r'  Raw String Suppress Escape not working in arcpy ArcGIS 10</title>
      <link>https://community.esri.com/t5/python-questions/r-nbsp-raw-string-suppress-escape-not-working-in/m-p/355493#M27941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If that is the case, how have my python scripts worked the past 3 years from Release 9.2 thru 9.3.1? Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 16:40:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/r-nbsp-raw-string-suppress-escape-not-working-in/m-p/355493#M27941</guid>
      <dc:creator>MikeMeeks</dc:creator>
      <dc:date>2011-04-20T16:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: r'  Raw String Suppress Escape not working in arcpy ArcGIS 10</title>
      <link>https://community.esri.com/t5/python-questions/r-nbsp-raw-string-suppress-escape-not-working-in/m-p/355494#M27942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Perhaps the expected syntax of that specific command changed between ArcGIS 9.3 and 10. I would say if it works the way you have it now then keep doing what works. Alternatively, a simple test would be to see if the command works without the literal single-quotes, so just:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Layers = "Road Centerline"
Scales = "2000;900"
All = "Recreate All Tiles"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If that doesn't work then it has nothing to do with raw strings and everything to do with whether literal single-quotes are needed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The example in the help on the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00540000000p000000.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;ManageMapServerCacheTiles_Server&lt;/A&gt;&lt;SPAN&gt; isn't very enlightening as they use empty strings for those parameters.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:39:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/r-nbsp-raw-string-suppress-escape-not-working-in/m-p/355494#M27942</guid>
      <dc:creator>LoganPugh</dc:creator>
      <dc:date>2021-12-11T16:39:20Z</dc:date>
    </item>
  </channel>
</rss>

