* TypeError - Need help passings args

Juho Schultz juho.schultz at helsinki.fi
Wed Nov 2 10:20:11 EST 2005


Ernesto wrote:
> My program is below.  I'm trying to use two Windows ".exe" files with
> my command line python interface.  I get user input, then call
> "launchWithoutConsole".  This was working OK until I introduced the
> 'args' part.  Now I get the following error everytime I call
> "launchWithoutConsole":
> 
>       return subprocess.Popen([command] + args,
> startupinfo=startupinfo).wait()
> 
> TypeError: can only concatenate list (not "str") to list
> 
> I'm not sure if it's the WAY I'm passing it or if it's the function
> itself (which I retrieved from
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/409002
> )
> 
> Please help.  Thanks!
> 
[command] is a list.  So also "args" should be a list,
otherwise [command] + args produces an error.
Add a few square brackets to the calls, just like in the link.



More information about the Python-list mailing list