<?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: SyntaxError: EOL while scanning string literal in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/syntaxerror-eol-while-scanning-string-literal/m-p/1141131#M26177</link>
    <description>&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/code-formatting-the-community-version/ba-p/1007633" target="_blank"&gt;Code formatting ... the Community Version - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;for line numbers etc&lt;/P&gt;&lt;P&gt;It sounds like you need to raw encode that line eg r"\some\path\some\file"&lt;/P&gt;&lt;P&gt;to ensure that the path is compliant with required specs.&lt;/P&gt;&lt;P&gt;Also don't mix "\" and "/" in paths as well&lt;/P&gt;</description>
    <pubDate>Mon, 07 Feb 2022 12:44:45 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2022-02-07T12:44:45Z</dc:date>
    <item>
      <title>SyntaxError: EOL while scanning string literal</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/syntaxerror-eol-while-scanning-string-literal/m-p/1141112#M26176</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to python , I am trying to read some data from CAD file using the below script , the script is works fine on Arcgis Pro 2.9.1 with no Errors But after publishing this to Arcgis server(10.9.1) as Geo-processing service and Submitting a job (post)&amp;nbsp; the job fails and showing me the following :&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeError&lt;/I&gt;: File "&amp;lt;string&amp;gt;", line 31 arcpy.MakeFeatureLayer_management(CADSrs, CADlyr,g_ESRI_variable_3'") ^ SyntaxError: EOL while scanning string literal&lt;/LI&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeError&lt;/I&gt;: Failed to execute (ImportCad).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abdullahAli91_0-1644225146502.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33238i585CC085A1B6F4D3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abdullahAli91_0-1644225146502.png" alt="abdullahAli91_0-1644225146502.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my script :&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Import system modules
import arcpy
arcpy.env.workspace = arcpy.GetParameterAsText(0)
Request_ID = arcpy.GetParameterAsText(1)
print(arcpy.env.workspace)
# Step through each dataset in the list
for fd in arcpy.ListDatasets("*"):
    layers = ["Polyline", "Polygon", "Point"]
    for lyrGeom in layers:
        print(lyrGeom)
        CADlyr = fd + "_" + lyrGeom
        CADSrs = fd + "/" + lyrGeom
        print(CADlyr)
        # Select the features on the drawing layer karar
        arcpy.MakeFeatureLayer_management(CADSrs, CADlyr, "\"Layer\" = 'karar'")
        with arcpy.da.SearchCursor(CADlyr,
                                   ["SHAPE@", "SHAPE@WKT", "OID@", "SHAPE@AREA", "SHAPE@LENGTH", "SHAPE@XY",
                                    "Layer"]) as cursor:
            for row in cursor:
                print("Feature {}:".format(row[2]))
                arcpy.AddMessage("Feature {}:".format(row[2]))
                print("Value of Spatial Reference = {}".format(row[0].spatialReference.name))
                sr = arcpy.SpatialReference(32637)
                newG = row[0].projectAs(sr)
                print (sr.name)
                arcpy.SetParameterAsText(2, sr.name)&lt;/LI-CODE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;the problem at the&amp;nbsp;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;\"&lt;/SPAN&gt;&lt;SPAN&gt;Layer&lt;/SPAN&gt;&lt;SPAN&gt;\"&lt;/SPAN&gt;&lt;SPAN&gt; = 'karar'"&amp;nbsp; &amp;nbsp;filter not accepted on runtime .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A title="ref" href="https://desktop.arcgis.com/en/arcmap/latest/manage-data/cad/using-python-to-load-cad-data.htm" target="_self"&gt;Reference&lt;/A&gt;&lt;SPAN&gt;&lt;A title="ref" href="https://desktop.arcgis.com/en/arcmap/latest/manage-data/cad/using-python-to-load-cad-data.htm" target="_self"&gt;&amp;nbsp;&lt;/A&gt;of my code&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;any idea how to solve this ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thanks for advance for your help,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 13:42:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/syntaxerror-eol-while-scanning-string-literal/m-p/1141112#M26176</guid>
      <dc:creator>abdullahAli91</dc:creator>
      <dc:date>2022-02-07T13:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: SyntaxError: EOL while scanning string literal</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/syntaxerror-eol-while-scanning-string-literal/m-p/1141131#M26177</link>
      <description>&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/code-formatting-the-community-version/ba-p/1007633" target="_blank"&gt;Code formatting ... the Community Version - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;for line numbers etc&lt;/P&gt;&lt;P&gt;It sounds like you need to raw encode that line eg r"\some\path\some\file"&lt;/P&gt;&lt;P&gt;to ensure that the path is compliant with required specs.&lt;/P&gt;&lt;P&gt;Also don't mix "\" and "/" in paths as well&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 12:44:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/syntaxerror-eol-while-scanning-string-literal/m-p/1141131#M26177</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-02-07T12:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: SyntaxError: EOL while scanning string literal</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/syntaxerror-eol-while-scanning-string-literal/m-p/1141494#M26178</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;DanPatterson&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;for your reply, I've tried to add r but also didn't work for me.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 05:51:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/syntaxerror-eol-while-scanning-string-literal/m-p/1141494#M26178</guid>
      <dc:creator>abdullahAli91</dc:creator>
      <dc:date>2022-02-08T05:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: SyntaxError: EOL while scanning string literal</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/syntaxerror-eol-while-scanning-string-literal/m-p/1141504#M26179</link>
      <description>&lt;P&gt;related?&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-questions/syntaxerror-eol-while-scanning-string-literal/m-p/1141503#M63676" target="_blank"&gt;Re: syntaxError: EOL while scanning string literal - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 08:12:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/syntaxerror-eol-while-scanning-string-literal/m-p/1141504#M26179</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-02-08T08:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: SyntaxError: EOL while scanning string literal</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/syntaxerror-eol-while-scanning-string-literal/m-p/1243728#M26647</link>
      <description>&lt;P&gt;An EOL ( End of Line ) error indicates that the Python interpreter expected a particular character or set of characters to have occurred in a specific line of code, but that those characters were not found before the end of the line . This results in Python stopping the program execution and throwing a syntax error .&lt;/P&gt;&lt;P&gt;The SyntaxError: EOL while &lt;A href="http://net-informations.com/python/err/eol.htm" target="_self"&gt;scanning string literal&lt;/A&gt; error in python occurs when while scanning a string of a program the python hit the end of the line due to the following reasons:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Missing quotes&lt;/LI&gt;&lt;LI&gt;Strings spanning multiple lines&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 07:14:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/syntaxerror-eol-while-scanning-string-literal/m-p/1243728#M26647</guid>
      <dc:creator>headmondjohn</dc:creator>
      <dc:date>2022-12-27T07:14:32Z</dc:date>
    </item>
  </channel>
</rss>

