Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
import argv
#1
Hi everyone,

I am trying to work through the text book 'Learn Python the hard way' and I am getting stuck on Exercise 13:

from sys import argv

script, first, second, third = argv

program = input("What program do you use? ")

print("The script is called:", script)
print("Your first variable is:", first)
print("Your second variable is:", second, f"{program}")
print("Your third variable is:", third) 
ValueError: not enough values to unpack (expected 4, got 3)

He explains this issue happens when you don't put enough arguments on the command when you run it. However I am not sure what he means because I copied his code exactly. Also he mentions reading WYSS section but I am note sure what that is, any ideas?

I am trying to run this in jupyter notebook
Reply


Messages In This Thread
import argv - by Scott - Nov-11-2019, 07:21 AM
RE: import argv - by fishhook - Nov-11-2019, 07:52 AM
RE: import argv - by snippsat - Nov-11-2019, 10:03 AM
RE: import argv - by radix018 - Apr-01-2021, 11:03 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I call sys.argv list inside a function, from the CLI? billykid999 3 828 May-02-2023, 08:40 AM
Last Post: Gribouillis
  sys.argv method nngokturk 3 1,131 Jan-23-2023, 10:41 PM
Last Post: deanhystad
  use of sys.argv deepakkr3110 3 3,086 Nov-29-2019, 05:41 AM
Last Post: buran
  Not all data returned from sys.argv ecdhyne 2 2,818 Sep-05-2019, 08:27 PM
Last Post: buran
  Pyinstaller with Sys.Argv[] - “Failed to Execute Script”? ironfelix717 0 5,350 Aug-07-2019, 02:29 PM
Last Post: ironfelix717
  I see is that sys.argv contains character strings helenharry 2 2,783 Jan-09-2019, 11:34 AM
Last Post: DeaD_EyE
  How argv works? Philia 7 4,876 Dec-26-2018, 12:20 AM
Last Post: metulburr
  sys.argv correct sintax? enricosx 3 3,248 Jul-25-2018, 09:27 AM
Last Post: buran
  I gotta problem with making argv parameters Bozx 3 4,106 Apr-04-2017, 03:44 AM
Last Post: alicarlos13
  argv IndexError hsunteik 2 4,581 Dec-19-2016, 06:19 AM
Last Post: hsunteik

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020