mark
mark

Reputation: 959

Passing arguments to exec from python shell

I'm using the python shell to launch a python script. I'm using the following command exec(open("G:\Yowsup\src\yowsup-cli").read())

the problem is that i need to pass some arguments like this, but i don't know the right syntax $ python yowsup-cli -c config.example -r sms

How to do it with Python 3?

EDIT Please note that i don't know python and i'm not going to learn it, i just need to run and make tests on yowsup

Upvotes: 0

Views: 1732

Answers (1)

Bestasttung
Bestasttung

Reputation: 2458

$ python test.py arg1 arg2 arg3

Then you can access arg in your script like that :

#!/usr/bin/python

import sys

print 'Number of arguments:', len(sys.argv), 'arguments.'
print 'Argument List:', str(sys.argv)

They are stocked in sys.argv as a list (sys.argv[0] = arg1 etc..)

Upvotes: 2

Related Questions