Opening a file and matching Engr Label
<p>1.Getting buildid from a buildlocation which is the last word after "\" which is "A1234ABCDE120083.1" in this case</p>

<p>2.After getting the buildid,am opening  a file and then trying to match the line "Engr Label: Data_CRM_PL_177999" to get the label name which is "Data_CRM_PL_177999"</p>

<p>3.Final output should be "Data_CRM_PL_177999"</p>

<p>For some reason I am getting the following syntax error..</p>

<pre><code> import re

 Buildlocation= '\\umor\locations455\INT\A1234ABCDE120083.1'

 Labelgetbuildlabel(Buildlocation)

def getbuildlabel(BuildLocation):
buildid=BuildLocation.split('\')[-1]
Notes=os.path.join(BuildLocation,Buildid + '_notes.txt')
if os.path.exists(Notes):
    try:
        open(Notes)
    except IOError as er:
        pass
    else:
        for i in Notes.splitlines:
        if i.find(Engr Label)
            label=i.split(:)[-1]

print label//output should be Data_CRM_PL_177999
</code></pre>

<p>Output should be:-</p>

<pre><code>Line looks like below in the file
Engr Label: Data_CRM_PL_177999
</code></pre>

<p>SYNTAX ERROR</p>

<pre><code> buildid=BuildLocation.split('\')[-1]
                                   ^
 SyntaxError: EOL while scanning string literal
</code></pre>
