# Docs library "sys.argv"

**URL:** <https://discuss.python.org/t/docs-library-sys-argv/105793>\
**Category:** Python Help\
**Created:** [January 19, 2026, 3:41pm UTC](https://discuss.python.org/t/docs-library-sys-argv/105793 "2026-01-19T15:41:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomasaws81](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@thomasaws81](https://discuss.python.org/u/thomasaws81)\
**Post date:** [January 19, 2026, 3:41pm UTC](https://discuss.python.org/t/docs-library-sys-argv/105793/1 "2026-01-19T15:41:28Z")

</div>

in my code:

1 import sys

2 print(“hello, my name is”, sys.argiv[1])

is printing out an error. what should i do to fix that code. i want it have a prompt to fill ….

---

<div class="post-metadata">

**Author:** ![inventshah](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/inventshah/32/29822_2.png) [@inventshah](https://discuss.python.org/u/inventshah)\
**Post date:** [January 19, 2026, 3:47pm UTC](https://discuss.python.org/t/docs-library-sys-argv/105793/2 "2026-01-19T15:47:31Z")

</div>

How are you running this script? What error is printed? If `sys.argv[1]` throws an `IndexError` you may not be passing in the argument via the command line ([docs](https://docs.python.org/3/library/sys.html#sys.argv)). The snippet you shared has a small typo, but this should work:

```python
import sys
print("hello, my name is", sys.argv[1])

```

Also, you may prefer using [`input()`](https://docs.python.org/3/library/functions.html#input) if you want to “prompt” the user for information. Example:

```python
name = input("What is your name?")
print("hello, my name is", name)

```

---

<div class="post-metadata">

**Author:** ![thomasaws81](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@thomasaws81](https://discuss.python.org/u/thomasaws81)\
**Post date:** [January 19, 2026, 3:57pm UTC](https://discuss.python.org/t/docs-library-sys-argv/105793/3 "2026-01-19T15:57:08Z")

</div>

if i define the name that mean the import of sys.argv serve for no purpose..

i have import that to avoid of defining “name” in my code.

---

<div class="post-metadata">

**Author:** ![thomasaws81](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@thomasaws81](https://discuss.python.org/u/thomasaws81)\
**Post date:** [January 19, 2026, 4:00pm UTC](https://discuss.python.org/t/docs-library-sys-argv/105793/4 "2026-01-19T16:00:41Z")

</div>

i try to define “name but still give me error i can fix indexerror but utilising the sys.argv is not effective in terminal

---

<div class="post-metadata">

**Author:** ![sinoroc](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/sinoroc/32/1607_2.png) [@sinoroc](https://discuss.python.org/u/sinoroc)\
**Post date:** [January 19, 2026, 5:22pm UTC](https://discuss.python.org/t/docs-library-sys-argv/105793/5 "2026-01-19T17:22:40Z")

</div>

What is the full error message?

Note that your code mentions `argiv` with an `i` while it should be `argv` without `i`.

---

<div class="post-metadata">

**Author:** ![thomasaws81](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@thomasaws81](https://discuss.python.org/u/thomasaws81)\
**Post date:** [January 19, 2026, 5:43pm UTC](https://discuss.python.org/t/docs-library-sys-argv/105793/6 "2026-01-19T17:43:24Z")

</div>

Thank you I will review and come back to you if anything happens

---

<div class="post-metadata">

**Author:** ![thomasaws81](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@thomasaws81](https://discuss.python.org/u/thomasaws81)\
**Post date:** [January 19, 2026, 5:52pm UTC](https://discuss.python.org/t/docs-library-sys-argv/105793/7 "2026-01-19T17:52:56Z")

</div>

It was just a tapo it not like that in my project.

I think the system.argv should be downloaded in my python environment before I use it in my codes?

---

<div class="post-metadata">

**Author:** ![fungi](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/fungi/32/5963_2.png) [@fungi](https://discuss.python.org/u/fungi)\
**Post date:** [January 19, 2026, 6:15pm UTC](https://discuss.python.org/t/docs-library-sys-argv/105793/8 "2026-01-19T18:15:03Z")

</div>

If you mean `sys.argv` that’s part of CPython’s “standard library” and should not need to be downloaded separately as it’s distributed with the interpreter under all but very unusual circumstances.

An IndexError exception when referencing `sys.argv[1]` implies the interpreter did not find any command-line arguments supplied to the script at invocation.
