Unable to resolve "Learn Python on AWS Workshop Python" error involving looping over JSON
I haven't been able to resolve the the following error that keeps showing up at the end of the Looping over JSON portion of Lab 6 in the "Learn Python on AWS Workshop" module:
error: the following arguments are required_ --file
Following the directions throughout the lab, I created the JSON file called
translate_input.json and copied the list of dictionaries contained within. Then I created a new python file called
lab_6_step_2_loops.py , typed in the text as directed, and ran the program with the command in the terminal python
lab_6_step_2_loops.py --file translate_input.json after which the above error appears.
I reached out to some coworkers who were also working on this but none of them have gotten back to me yet. Additionally, I've gone over all of the previous labs of this Python workshop to see what/if I missed anything, read numerous explanations, and watched several tutorials on YouTube regarding argparse and json. All of this was helpful but danced around the general issue without actually helping me resolve it but leads me to think the issue is related to the first section of the code.
parser = argparse.ArgumentParser(description="Provides translation between one source language and another of the same set of languages.") parser.add_argument( '--file', dest='filename', help="The path to the input file. The file should be valid json", required=True)
Leaving this code as is, inputting the file name, file path, destination, or some combination keeps bringing up the same error as above. When I follow the directions in the link and literally just copy and paste- no typing- the text, I still come up with this error. Any thoughts?
Based on the error, it looks like you may be executing the python file without the --file argument. Make sure you include
--file translate_input.json like this:
python lab_6_step_2_loops.py --file translate_input.json
Thank you! How exactly would that look like in the code? I know I've tried this without success, and again just now after you suggested it, but I may also be misunderstanding or thinking of something completely different.
This would not be in the code, this is what you would execute in the command line after pasting the code into
Thanks for clarifying. I've done that more times than I can remember so I'm ready to admit the error is something out of my control. Thank you for your help!
Error connection to the API!asked 3 years ago
Access error : Spark query from AWS EMR with AWS Lake Formationasked 4 months ago
AWS Serverless SaaS Workshop - Issue - Python Version -asked a month ago
Unable to resolve "Learn Python on AWS Workshop Python" error involving looping over JSONasked 3 months ago
DNS failure after Ubuntu 14 LTS update to 18 LTSasked 3 years ago
Unable to resolve Permission Error - Python and AWS EBasked 3 months ago
API Gateway CORS error after update aws-cdk update to 1.135.0asked 3 months ago
Unable to resolve host ip-XX: Resource temporarily unavailableasked 2 years ago
"E: Unable to locate package python-pip", Python 3.6.10, pip 9.0.3asked 2 years ago
Scaling websocket notificationsAccepted Answerasked 2 years ago