Reputation: 861
In my program when I call this filename:
msTestPrompt = r'"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\MSTest.exe"'
It doesnt work, it says the filename, directory name or volume syntax is incorrect. I have tried just about every combination of ways to fix this and I just can't get it working, no matter what I do to the string. Thanks in advance for any help.
Edit: Here is what uses the file name string
p = subprocess.Popen([msTestPrompt, blah], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
Edit2: Here is the blah variable:
resultsFile = "/resultsfile:" + os.path.normpath('"C:/BB1.trx"')
testSettings = "/testsettings:" + os.path.normpath('"C:/Users/bgb/Documents/Brent/Code/Visual Studio/Local.testsettings"')
testContainer = '/testcontainer:"C:\Users\bgb\Documents\Brent\Code\Visual Studio\DesignF.UnitTests\bin\Debug\DesignF-UnitTests.dll"'
blah = str(' ' + testContainer + ' ' + resultsFile + ' ' + testSettings)
Upvotes: 0
Views: 171
Reputation: 6326
Try:
msTestPrompt = r'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe'
If you place r
in front of a string you don't need to escape the backslash anymore.
EDIT:
What if you change the blah
variable to this:
resultsFile = r'/resultsfile:C:\BB1.trx'
testSettings = r'/testsettings:C:\Users\bgb\Documents\Brent\Code\Visual Studio\Local.testsettings'
testContainer = r'/testcontainer:C:\Users\bgb\Documents\Brent\Code\Visual Studio\DesignF.UnitTests\bin\Debug\DesignF-UnitTests.dll'
blah = str(' ' + testContainer + ' ' + resultsFile + ' ' + testSettings)
Upvotes: 1