python subprocess.call with multiples arguments

I'm trying to call mattermost "platform" application from a python script to create users & teams from a CSV file but i'm having an issue with the subprocess.call command which doesn't seems to recognize any parameter passed after --name.  I'm new to python so i won't be offended if you point me the obvious.

my CSV files got columns group, group_display, email, password.

with open("./accounts.csv", "rb") as wFile:
    os.chdir("/opt/mattermost/bin")
    wReader = csv.DictReader(wFile)
    for wLine in wReader:
        wCommand = []
        wCommand.append('./platform')
        wCommand.append('team')
        wCommand.append('create')
        wCommand.append('--name ' + wLine['group'])
        wCommand.append('--display_name \"' + wLine['group_display'] + '\"')
        wCommand.append('--private')
        print wCommand
        wRet = subprocess.call(wCommand)
        if (wRet == 0):
                print 'Imported ' + wLine['email']
        else:
                print 'Error importing ' + wLine['email']

Open in new window


i'm getting the error:

Error: unknown flag: --name mycustomername
Usage: platform team create [flags]


If i run the command from the cmd line with this command, it will pass:
./platform team create --name mycustomername --display_name "The Full Customer Name" --private

Any idea what i'm missing?
LVL 10
Christian de BellefeuilleProgrammerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nociSoftware EngineerCommented:
the --name mycustormername should be passed in two appends...

wCommand.append('--name ')
wCommand.append(wLine['group'])
btw. same for --displayname.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Christian de BellefeuilleProgrammerAuthor Commented:
look like you nailed it!   Thanks a lot!
0
nociSoftware EngineerCommented:
np.   On general for unix commands Each work  on the command line should translate to an argument
If a argumentlist is required then the break up should be done by the programmer.
when you issue a shell command the shell breaks up the argument to separate words.  (hence the various quoting mechanisms to get the right result).
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.