In my script, I want to take image name as an argument (argv) and do some image processing then save it an output directory with a filename like inputFileName_output.
# saving figure
UPLOAD_FOLDER = "./Output_Images_test"
outputfile = file.split(".")[0] + "__output.txt"
plt.savefig("%s/%s", dpi=300) %UPLOAD_FOLDER %outputfile
If someone runs into the same problem as me, here's what I did to solve it. I joined the upload folder and outputfile using os.path.join.
# saving figure
outputfile_name = file.split(".")[0] + "__output.png"
output_image_path = os.path.join(UPLOAD_FOLDER, outputfile_name)
plt.savefig(output_image_path, dpi=300)