[Tutor] not invoking the shell from python
alan.gauld at freenet.co.uk
Tue Jun 21 18:58:46 CEST 2005
> input but the shell still expands out certain characters. I noticed
> with python2.4. How do I bypass the shell and hand arguments
> to the program?
The first thing I'd do is create the command string before passing
it to popen - that way we can debug easier by seeing exactly what
is being passed through!
> The problematic line in question looks like this:
cmd = '''rt create -t ticket set requestor='%s' owner='%s'
queue='%s' subject="%s" text="%s" status='%s' ''' %
# your code was missing the closing parens above but I assume
# that was just a posting error?
print cmd # for debug only
See if the line you are producing is what you think it should be.
Try typing it in at the shell and see if you get the same effect?
Without knowing the details of your data its hard to say much more.
Author of the Learn to Program web tutor
More information about the Tutor