bruno mac
bruno mac

Reputation: 23

Concatenate UNC path under Windows in Python

Using Python 3, looking for a nudge in the right direction because raw_input isn't behaving like I thought.

self.softwareOptions = {'1': "\X", '2': "\Y", '3':"\Z"}
self.sourceSoftware=r"\\Cdc1\cdc\Visual Studio 2015\Projects\WPF 2015 Projects"
self.sourceAppend=r"\JCOutput\Release"

    def BuildSourcePath(self):
        return os.path.join(self.sourceSoftware , self.selectedSoftware, self.sourceAppend)

At another point in the program the user is queried to enter 1,2,3 to append the appropriate path. The output, however, always cuts the path off at \V, so I end up with \cdc1\cdc\JCOutput\Release

Upvotes: 0

Views: 659

Answers (1)

Daniel
Daniel

Reputation: 42758

You have to use relative paths:

self.softwareOptions = {'1': "X", '2': "Y", '3':"Z"}
self.sourceSoftware=r"\\Cdc1\cdc\Visual Studio 2015\Projects\WPF 2015 Projects"
self.sourceAppend=r"JCOutput\Release"

def BuildSourcePath(self):
    return os.path.join(self.sourceSoftware, self.selectedSoftware, self.sourceAppend)

Upvotes: 1

Related Questions