The following code is intended to check if a path to sync is included in the command string: for arg in sys.argv[1:]: if not arg.startswith("-"): srcfound = 1 arg = os.path.abspath(arg) cmdcommon.append(arg) However, if we can't know if a parameter that doesn't start with a "-" is a path to sync or an argument to a flag just before it. At least, we can't know this if we don't know which flags take arguments and which ones don't. We should use the options struct to find out. Note that we can't only use the prompt string since this problem can occur for long options too. The correct way to solve this might be to create a general wrapper script framework, in which case we should look over all our wrapper scripts.