![]() |
Stuck again, what's wrong? - Printable Version +- Linux Lite Forums (https://www.linuxliteos.com/forums) +-- Forum: Development (https://www.linuxliteos.com/forums/forumdisplay.php?fid=7) +--- Forum: Coding (https://www.linuxliteos.com/forums/forumdisplay.php?fid=33) +--- Thread: Stuck again, what's wrong? (/showthread.php?tid=5473) |
Stuck again, what's wrong? - colin - 07-13-2018 I'm trying to learn Python3 from the book Learn Python 3 the Hard Way and find it hard going especially when the code keeps on displaying an error. Take for instance, exercise 20. Code: # ex20: Functions and Files Code: colin@my_new_LinuxLite4.0:~$ python3 ~/python_exp/ex20.pyTraceback (most recent call last): File "/home/colin/python_exp/ex20.py", line 7, in <module> script, input_file = argvValueError: not enough vales to unpack (expected 2, got 1)colin@my_new_LinuxLite4.0:~$ Re: Stuck again, what's wrong? - bitsnpcs - 09-24-2018 Hello [member=6850]colin[/member] , it looks like you are running the file incorrectly as you are not specifying the command in terminal. I do not have the Python3 book only the Python2, I had a try at this one though to help ![]() The Python, notice the line changes and indentations. ![]() The test.txt file used (contents are his words not mine) from an exercise in the Python2 book, I just renamed it to use for this try. ![]() How to run it in terminal ![]() On highlight in terminal see #1, #2 and #3 above, these are the components of the command that you need. For #2 you can either cd to the directory containing your Python files, or you can enter in your Path as previously. I just put it in Home directory as its temporary for this post. #3 is what you have missed in the terminal command ? or it is in another folder than the Python file is. Re: Stuck again, what's wrong? - Shanti - 09-25-2018 need to install gedit. ![]() ![]() Python looks fun Re: Stuck again, what's wrong? - bitsnpcs - 09-25-2018 [member=8093]Shanti[/member] great work, glad you liked Python 8) Re: Stuck again, what's wrong? - Shanti - 09-27-2018 Gedit up now ![]() ![]() Re: Stuck again, what's wrong? - bitsnpcs - 09-27-2018 You are welcome [member=8093]Shanti[/member] ![]() Re: Stuck again, what's wrong? - colin - 10-26-2018 Thanks for the help once again bitsnpcs. Re: Stuck again, what's wrong? - bitsnpcs - 10-26-2018 You are Welcome Colin ![]() |