LP3THW Excercise 13 [on hold]
LP3THW Excercise 13 [on hold]
I am going through Zed Shaws LP3THW and I can't seem to excecute excercise 13 properly.
from sys import argv
#Read the WYSS Section for how to run this script
script, first, second, third = argv
print("The script is called:", script)
print("Your first variable is:", first)
print("Your second variable is:", second)
print("Your third variable is:", third)
There are some scripts posted on github of the same excercise however I can't seem to run them either. :S
https://github.com/r3gr3b/LP3THW/blob/master/ex13.py
The Error Message:
Traceback (most recent call last):
File "C:/Users/adeel/Desktop/Adeel/Python/LP3THW/Ex13(3).py", line 3, in <module>
script, first, second, third = argv
ValueError: not enough values to unpack (expected 4, got 1)
Page 72 of the https://github.com/broughjt/lp3thw/blob/master/lp3thw.pdf book.
Any help would be super appreciated :)
This question appears to be off-topic. The users who voted to close gave this specific reason:
I'm running it on Pycharm. The Error I get is as follows Traceback (most recent call last): File "C:/Users/adeel/Desktop/Adeel/Python/LP3THW/Ex13(3).py", line 3, in <module> script, first, second, third = argv ValueError: not enough values to unpack (expected 4, got 1)
– Adeel Ali
Jul 1 at 15:10
The program is trying to unpack your command-line arguments, and you're not specifying any. Presumably the tutorial must explain this.
– khelwood
Jul 1 at 15:12
I don't understand what a Command line argument is and the book doesn't really help.It says I must pass three Command line arguments.
– Adeel Ali
Jul 1 at 15:13
Have you tried google? en.wikipedia.org/wiki/Command-line_interface#Arguments
– Aran-Fey
Jul 1 at 15:14
1 Answer
1
I had to use the Windows Powershell to excecute the file, the book did tell you how to do it but it was way earlier and I was using the IDE to run the files before which is why I was kind of confused.
Thanks for your help everyone :)
"can't seem to execute"? How are you trying and what is going wrong?
– khelwood
Jul 1 at 15:07