title: Passing directory paths as strings to argparse in Python
body: <p><strong>Scenario:</strong> I have a python script that receives as inputs 2 directory paths (input and output folders) and a variable ID. With these, it performs a data gathering procedure from xlsx and xlsm macros, modifies the data and saves to a csv (from the input folder, the inner functions of the code will run loops, to get multiple files and process them, one at a time).</p>
  
  <p><strong>Issue:</strong> Since the code was working fine when I was running it from the Spyder console, I decided to step it up and learn about cmd caller, argparse and the <strong>main</strong> function. I trying to implement that, but I get the following error:</p>
  
  <pre><code>Unrecognized arguments (the output path I pass from cmd)
  </code></pre>
  
  <p><strong>Question:</strong> Any ideas on what I am doing wrong?</p>
  
  <p><strong>Obs:</strong> If the full script is required, I can post it here, but since it works when run from Spyder, I believe the error is in my argparse function.</p>
  
  <p><strong>Code (argparse function and __main__):</strong></p>
  
  <pre><code># This is a function to parse arguments:
  def parserfunc():
      import argparse
      parser = argparse.ArgumentParser(description='Process Files')
      parser.add_argument('strings', nargs=3)
      args = parser.parse_args()
      arguments = args.strings
      return arguments
  
  # This is the main caller    
  def main():
      arguments = parserfunc()
      # this next function is where I do the processing for the files, based on the paths and id provided):
      modifierfunc(arguments[0], arguments[1], arguments[2])
  
  #
  if __name__ == "__main__":
      main()
  </code></pre>