I'm writing some code that uses an Onclick event to get some file paths. I need to make sure these file paths are literals to make sure they're correct so the rest of my code can run. Right now I think I'm getting the file paths as unicode. Essentially I need this:
u"File\location\extra\slash"
to be this:
r"File\location\extra\slash"
How do I do this? I haven't been able to find anyone who's actually been able to do this successfully and the documentation doesn't have any examples of this. I can't change how the function that gives me the file paths Onclick event works.
Here is the code in question:
class SetLayer(object):
"""Implementation for leetScripts_addin.button2 (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
self.a = pythonaddins.GetSelectedCatalogWindowPath()
print self.a
#code split up path here
self.b = os.path.split(str(self.a))
self.c = self.b[0]
self.d = os.path.split(self.c)
self.e = (self.b[1])
self.f = (self.d[1])
self.g = (self.d[0])