But I wanted to put the date in the file name using -n {date:%Y-%m-%d}
It doesn't work..
As a result of checking a little bit, all the'date' values stored in the variable resources appear as 'None'.
So it seems that the following error appears.
ractically scan 853 weibos, get 1837 resources
Traceback (most recent call last):
File "D:\weibo\weiboPicDownloader.py", line 377, in
path = os.path.join(album, format_name(resource))
File "D:\weibo\weiboPicDownloader.py", line 286, in format_name
return safeify(re.sub(r'{(.*?)}', substitute, args.name))
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\re.py", line 210, in sub
return _compile(pattern, flags).sub(repl, string, count)
File "D:\weibo\weiboPicDownloader.py", line 278, in substitute
return item[key[0]].strftime(key[1]) if len(key) > 1 else str(item[key[0]])
AttributeError: 'NoneType' object has no attribute 'strftime'
Thanks for the good code.
But I wanted to put the date in the file name using -n {date:%Y-%m-%d} It doesn't work..
As a result of checking a little bit, all the'date' values stored in the variable resources appear as 'None'.
So it seems that the following error appears.
ractically scan 853 weibos, get 1837 resources Traceback (most recent call last): File "D:\weibo\weiboPicDownloader.py", line 377, in
path = os.path.join(album, format_name(resource))
File "D:\weibo\weiboPicDownloader.py", line 286, in format_name
return safeify(re.sub(r'{(.*?)}', substitute, args.name))
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\re.py", line 210, in sub
return _compile(pattern, flags).sub(repl, string, count)
File "D:\weibo\weiboPicDownloader.py", line 278, in substitute
return item[key[0]].strftime(key[1]) if len(key) > 1 else str(item[key[0]])
AttributeError: 'NoneType' object has no attribute 'strftime'
Could you please give me a solution?