fix crash on Windows10 when configure script given no HF token

Crashes would occur in the invokeai-configure script if no HF token
was found in cache and the user declines to provide one when prompted.
The reason appears to be that on Linux systems getpass_asterisk()
raises an EOFError when no input is provided

On windows10, getpass_asterisk() does not raise the EOFError, but
returns an empty string instead. This patch detects this and raises
the exception so that the control logic is preserved.
This commit is contained in:
Lincoln Stein 2023-02-03 16:06:49 -05:00
parent c50b64ec1d
commit 7fa3a499bb

View File

@ -320,6 +320,8 @@ You may re-run the configuration script again in the future if you do not wish t
while again:
try:
access_token = getpass_asterisk.getpass_asterisk(prompt="HF Token ")
if access_token is None or len(access_token)==0:
raise EOFError
HfLogin(access_token)
access_token = HfFolder.get_token()
again = False