I have following code:
ap = argparse.ArgumentParser()
ap.add_argument("-o", "--output", required=True, help="path to the output directory")
args = vars(ap.parse_args())
jsonPath = os.path.sep.join([args["output"], "{}.json".format(os.getpid())])
f = open(jsonPath, "w")
I run script with arguments as '--output output'. 'output' directory is at same level as script. I get error as:
FileNotFoundError: [Errno 2] No such file or directory: 'output\xyz.json'
xyz is pid here.
What is correct way of doing it in windows 10?