Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Invalid format string #25

Open
Cr2zyIvan opened this issue Dec 27, 2016 · 4 comments
Open

ValueError: Invalid format string #25

Cr2zyIvan opened this issue Dec 27, 2016 · 4 comments
Assignees

Comments

@Cr2zyIvan
Copy link

输入-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

@RicterZ
Copy link
Owner

RicterZ commented Dec 27, 2016

-b 2010-10-10

@Cr2zyIvan
Copy link
Author

依然报错- -
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

@RicterZ RicterZ self-assigned this Dec 31, 2016
@debugray
Copy link

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

@y0rkl4u
Copy link

y0rkl4u commented May 5, 2017

这个错误应该是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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants