genpAss icon indicating copy to clipboard operation
genpAss copied to clipboard

ValueError: Invalid format string

Open Cr2zyIvan opened this issue 8 years ago • 4 comments

输入-b 年-月-日 后,出现如下报错。

Traceback (most recent call last): File "C:\Python27\Scripts\genpass-script.py", line 9, in load_entry_point('genpass==0.2.1', 'console_scripts', 'genpass')() File "C:\Python27\lib\site-packages\genpass-0.2.1-py2.7.egg\genpass\command.py ", line 30, in main map(gen.genpass, person_list) File "C:\Python27\lib\site-packages\genpass-0.2.1-py2.7.egg\genpass\command.py ", line 20, in genpass for i in passwords: File "C:\Python27\lib\site-packages\genpass-0.2.1-py2.7.egg\genpass\lib\person .py", line 121, in generate_password self.generate_source_dict() File "C:\Python27\lib\site-packages\genpass-0.2.1-py2.7.egg\genpass\lib\person .py", line 85, in generate_source_dict returned = generator.generator_map(data, rule) File "C:\Python27\lib\site-packages\genpass-0.2.1-py2.7.egg\genpass\generator. py", line 20, in generator_map result.update(map(format_func, data)) File "C:\Python27\lib\site-packages\genpass-0.2.1-py2.7.egg\genpass\rules\buil t_in.py", line 32, in lambda x: time.strftime('%y%-m%-d', x), ValueError: Invalid format string

Cr2zyIvan avatar Dec 27 '16 02:12 Cr2zyIvan

-b 2010-10-10

RicterZ avatar Dec 27 '16 03:12 RicterZ

依然报错- - C:\Python27\Scripts>genpass.exe -b 2010-10-10 Traceback (most recent call last): File "C:\Python27\Scripts\genpass-script.py", line 9, in load_entry_point('genpass==0.2.1', 'console_scripts', 'genpass')() File "C:\Python27\lib\site-packages\genpass-0.2.1-py2.7.egg\genpass\command.py ", line 30, in main map(gen.genpass, person_list) File "C:\Python27\lib\site-packages\genpass-0.2.1-py2.7.egg\genpass\command.py ", line 20, in genpass for i in passwords: File "C:\Python27\lib\site-packages\genpass-0.2.1-py2.7.egg\genpass\lib\person .py", line 121, in generate_password self.generate_source_dict() File "C:\Python27\lib\site-packages\genpass-0.2.1-py2.7.egg\genpass\lib\person .py", line 85, in generate_source_dict returned = generator.generator_map(data, rule) File "C:\Python27\lib\site-packages\genpass-0.2.1-py2.7.egg\genpass\generator. py", line 20, in generator_map result.update(map(format_func, data)) File "C:\Python27\lib\site-packages\genpass-0.2.1-py2.7.egg\genpass\rules\buil t_in.py", line 32, in lambda x: time.strftime('%y%-m%-d', x), ValueError: Invalid format string

Cr2zyIvan avatar Dec 28 '16 09:12 Cr2zyIvan

我也遇到这个报错,但是查资料显示The usage of strftime("%s") is platform dependent and seems to not work on windows.

debugray avatar Mar 15 '17 08:03 debugray

这个错误应该是genpAss/genpass/rules/built_in.py中的date_formats 最后几行的格式错误吧,%位置不正确: lambda x: time.strftime('%y%-m%-d', x), lambda x: time.strftime('%Y%-m%-d', x), lambda x: time.strftime('%-m%-d', x) 改为如下即可: lambda x: time.strftime('%y-%m-%d', x), lambda x: time.strftime('%Y-%m-%d', x), lambda x: time.strftime('%m-%d', x)

y0rkl4u avatar May 05 '17 06:05 y0rkl4u