Probably you didn’t provide an argument on the command line. In that case, sys.argv
only contains one value, but it would have to have two in order to provide values for both user_name
and script
.
More Related Contents:
- How to pass arguments to a Button command in Tkinter?
- TypeError: method() takes 1 positional argument but 2 were given
- Normal arguments vs. keyword arguments
- Why does using `arg=None` fix Python’s mutable default argument issue?
- How to expand a list to function arguments in Python [duplicate]
- How do I create a Python function with optional arguments?
- Cannot pass an argument to python with “#!/usr/bin/env python”
- How can I pass information (a variable) out of a function? How can I use that from outside, e.g. in other functions?
- Best way to check function arguments? [closed]
- How can I read a function’s signature including default argument values?
- How to pass an argument to event handler in tkinter?
- Python function as a function argument?
- Overloaded functions in Python
- Is there a way to change effective process name in Python?
- Can you list the keyword arguments a function receives?
- Python passing list as argument
- Error – input expected at most 1 argument, got 3
- What is a maximum number of arguments in a Python function?
- Which exception should I raise on bad/illegal argument combinations in Python?
- Modifying function arguments
- Passing argument from Parent function to nested function Python
- How can I print multiple things (fixed text and/or variable values) on the same line, all at once?
- “TypeError: method() takes 1 positional argument but 2 were given” but I did only pass one
- “TypeError: method() takes 1 positional argument but 2 were given” but I only passed one
- In Python, can I specify a function argument’s default in terms of other arguments?
- Difference between mutation, rebinding, copying value, and assignment operator [duplicate]
- Calling superclass constructors in python with different arguments
- Unpacking arguments: only named arguments may follow *expression
- With “args” vs without “args” to pass arguments to a thread in Python
- How can the built-in range function take a single argument or three?