I’m simply trying to handle an uploaded file and write it in a working dir which name is the system timestamp. The problem is that I want to create that directory with full permission (777) but I can’t! Using the following piece of code the created directory with 755 permissions.
def handle_uploaded_file(upfile, cTimeStamp):
target_dir = "path_to_my_working_dir/tmp_files/%s" % (cTimeStamp)
os.makedirs(target_dir, mode=0777)
According to the official python documentation the mode argument of the
os.makedirsfunction may be ignored on some systems, and on systems where it is not ignored the current umask value is masked out.Either way, you can force the mode to 0o777 (0777 threw up a syntax error) using the
os.chmodfunction.