Tobias
Tobias

Reputation: 155

Python: Pass a "<" to Popen

I want to start the testrunner.bat of ReadyApi with parameters. I try to pass some XML parts (PeriodEnd in the code below) as arguments to subprocess.Popen:

argslist = ['C:/Program Files/SmartBear/ReadyAPI-1.9.0/bin/testrunner.bat',
    '-a', '-s', 'TestSuite', '-c', 'TestCase', '-f', 'C:/temp/', '-P', 
    'PeriodEnd=<PeriodEnd>2017-04-11T00:00:00.000Z</PeriodEnd>', 
    'C:/temp/soapui-project.xml']
proc = Popen(argslist, stdout=PIPE, stderr=PIPE)

This produces the following error:

The system cannot find the file specified.

I found out, that the "<" and ">" are the problems. How can I escape them or pass them to Popen?

Upvotes: 0

Views: 286

Answers (2)

etheranger
etheranger

Reputation: 1273

The escape character in CMD is ^.

C:\> echo asdf<123>
The syntax of the command is incorrect.

C:\> echo asdf^<123^>
asdf<123>

Upvotes: 1

ralf htp
ralf htp

Reputation: 9422

\ is used to escape character, try \<

https://docs.python.org/2.0/ref/strings.html

possibly use " instead of the '

Upvotes: 0

Related Questions