Apr-03-2024, 03:38 PM
I am a definite newbie to python. I've written some pretty basic programs that use shell scripts to pass user supplied arguments to my python programs. The problem I have now is that several of my parameters have spaces (for example an address line might read something like '1116 E. State St.'). The python program just parses the list of arguments each with one word. So my address line would be 4 arguments. I've tried single quotes, double quotes, three single ('''1116...'''), three double ("""1116..."""), and combinations of each of those. How do I pass my parameters as needed?
My shell program is attached.
This is the error I get:
(v398) -bash5.2 /home/opensource/pysrc/tst/RepEmploymentVerification $ rep_employment_verification.sh tst 1 kaustin Richard Green 123-45-6789 He Him Cutco ''''State Street'''' Olean NY 14760 Karen 585-968-1497 Jan12020 N Feb1202 N Feb22015 00004
---------------------------
** tst (tst) ENV LOADED **
Traceback (most recent call last):
File "/home/opensource/pysrc/tst/RepEmploymentVerification/./rep_employment_verification2.py", line 474, in <module>
scriptName, environment, letterType, userName, firstName, lastName, socSecNumber, pronoun, pronoun2, companyName, address, city, state, zip, attention, faxNumber, lastActiveDate, lastActiveDateFlag, lastOrderDate, lastOrderDateFlag, contractDate, company = argv
ValueError: too many values to unpack (expected 22)
My shell program is attached.
This is the error I get:
(v398) -bash5.2 /home/opensource/pysrc/tst/RepEmploymentVerification $ rep_employment_verification.sh tst 1 kaustin Richard Green 123-45-6789 He Him Cutco ''''State Street'''' Olean NY 14760 Karen 585-968-1497 Jan12020 N Feb1202 N Feb22015 00004
---------------------------
** tst (tst) ENV LOADED **
Traceback (most recent call last):
File "/home/opensource/pysrc/tst/RepEmploymentVerification/./rep_employment_verification2.py", line 474, in <module>
scriptName, environment, letterType, userName, firstName, lastName, socSecNumber, pronoun, pronoun2, companyName, address, city, state, zip, attention, faxNumber, lastActiveDate, lastActiveDateFlag, lastOrderDate, lastOrderDateFlag, contractDate, company = argv
ValueError: too many values to unpack (expected 22)
Attached Files
rep_employment_verification.txt (Size: 2.46 KB / Downloads: 29)