I am using subprocess to get a build path on a server by using a findbuild.exe..Some exe that finds builds on server using a build string. I store the output from findbuild.exe in "out" variable ..shown below
process = subprocess.Popen(findBuild_cmd, stdout=subprocess.PIPE, stderr = subprocess.PIPE)
out,err = process.communicate()
I parse it to get the build location and discard the rest of it using
sblTemp = str((out.partition("Location: ")[2]).partition("\n")[0])
sblTemp is a network path like \\water\build\12345\123.4\
I want to add offset to that like \boot\builds\bin\abc.mbn
So, the final path I want is
\\water\build\12345\123.4\boot\builds\bin\abc.mbn
I used os.path.join but found out that the string was getting over written by the later offset.
When I am trying to concat the above two, I am seeing that if I do this
temp = r"XYZ"+ sbl
, it works fine but when I try to do it this way temp = sblTemp + r"XYZ"
it overwrites the first string
Could you help me figure out what is going wrong here?
I figured out what was going wrong. The findBuild.exe was adding a carriage return at the end of the string and that was messing up everything. When I added .strip, it works fine :)