Search code examples
pythonshellcommand-linetagging

Python: syntax when adding parameters in cmd


I followed the instructions from imagga to run a python script to auto tag multiple images with keywords at once using a 3rd party API (called imagga)
In the required script I have to add 3rd API Key and input and output parameters when running the script. (input is the folder containing the images and output is the folder to contain the results the script generates)
But I'm not a programmer, I don't know how to write the syntax correctly. That's why the code can't run properly, and it shows an error saying I have to add two parameters: input and output
I'm hoping someone can give me a clear syntax example in cmd so I can run this script properly. This is a 3rd party guide (imagga)
https://imagga.com/blog/batch-image-processing-from-local-folder-using-imagga-api/
(I added API key and API secret as instructions)
This is the original script code from imagga. (line 98 99 105 106)
https://bitbucket.org/snippets/imaggateam/LL6dd
I saved script as: tag.py
I try to run in cmd with this prompt: tag.py
But cmd sent me an error that I need add input and output arguments

I am trying to successfully launch a python script to automatically tag images in a local folder and export the results to another local folder


Solution

  • Based on the script you provided, to run it with the required input and output parameters, you would use the following syntax in your command prompt (cmd):

    python3 tag.py <input_folder_path> <output_folder_path>
    

    Replace <input_folder_path> with the path to the folder containing the images you want to tag, and <output_folder_path> with the path to the folder where you want the script to save the results. Make sure to remove the angle brackets (< and >) when you replace these with your actual folder paths.