2021年4月28日星期三

NameError: name 'original_umask' is not defined

I am getting a NameError: name 'original' is not defined and NameError: name 'original_umask' is not defined I dont understand why Thanks for your time!          from Lib.data_loader import DataLoader  #from Lib.utils import mkdirs  import os                def mkdirs(folder, permission):      if not os.path.exists(folder):          try:              original.umask = os.umask(0)              os.makedirs(folder, premission, exist_ok-True)          finally:              os.umask(original_umask)  data_root = r"D:\FYP\DataSet"  csv_labels = r"D:\FYP\DataSet\jester-v1-labels.csv"  csv_train = r"D:\FYP\DataSet\jester-v1-train.csv"  csv_val = r"D:\FYP\DataSet\jester-v1-validation.csv"  csv_test = r"D:\FYP\DataSet\jester-v1-test.csv  "  data_vid = r"D:\FYP\DataSet\videos"  model_name = 'resent_3d_model'  data_model = r"D:\FYP\DataSet\Model"  path_model = os.path.join(data_root, data_model, model_name)  path_vid = os.path.join(data_root, data_vid)  path_labels = os.path.join(data_root, csv_labels)  path_train = os.path.join(data_root, csv_train)  path_val = os.path.join(data_root, csv_val)  path_test = os.path.join(data_root, csv_test)    data = DataLoader(path_vid, path_labels, path_train, path_val)  mkdirs(path_model, 0o755)  mkdirs(os.path.join(path_model, "graphs"), 0o755)  

And error is there

NameError Traceback (most recent call last) in mkdirs(folder, permission) 3 try: ----> 4 original.umask = os.umask(0) 5 os.makedirs(folder, premission, exist_ok-True)

NameError: name 'original' is not defined    During handling of the above exception, another exception occurred:    NameError                                 Traceback (most recent call last)  <ipython-input-10-a9db2744f07e> in <module>        1 data = DataLoader(path_vid, path_labels, path_train, path_val)  ----> 2 mkdirs(path_model, 0o755)        3 mkdirs(os.path.join(path_model, "graphs"), 0o755)    <ipython-input-7-378f7bc77b89> in mkdirs(folder, permission)        5             os.makedirs(folder, premission, exist_ok-True)        6         finally:  ----> 7             os.umask(original_umask)     NameError: name 'original_umask' is not defined  

https://stackoverflow.com/questions/67310479/nameerror-name-original-umask-is-not-defined April 29, 2021 at 11:05AM

没有评论:

发表评论