Problem with access token after the security update

I have been using access token in app.py to read/write a dataset. Due to a recent security update on HuggingFace, my access token was revoked. I had to create a new token, but app.py returned a runtime error everytime when I tried to run this line of code:
login(token=os.environ.get(“new_data_token”), write_permission=True)

/usr/local/lib/python3.10/getpass.py:91: GetPassWarning: Can not control echo on the terminal.
passwd = fallback_getpass(prompt, stream)
Warning: Password input may be echoed.
Enter your token (input will not be visible): Traceback (most recent call last):
File “/usr/local/lib/python3.10/getpass.py”, line 69, in unix_getpass
old = termios.tcgetattr(fd) # a copy to save
termios.error: (25, ‘Inappropriate ioctl for device’)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/user/app/app.py”, line 15, in
login(token=os.environ.get(“new_data_token”), write_permission=True)
File “/usr/local/lib/python3.10/site-packages/huggingface_hub/_login.py”, line 115, in login
interpreter_login(new_session=new_session, write_permission=write_permission)
File “/usr/local/lib/python3.10/site-packages/huggingface_hub/_login.py”, line 191, in interpreter_login
token = getpass("Enter your token (input will not be visible): ")
File “/usr/local/lib/python3.10/getpass.py”, line 91, in unix_getpass
passwd = fallback_getpass(prompt, stream)
File “/usr/local/lib/python3.10/getpass.py”, line 126, in fallback_getpass
return _raw_input(prompt, stream)
File “/usr/local/lib/python3.10/getpass.py”, line 148, in _raw_input
raise EOFError
EOFError

Please help. Thanks!!

Hi,

It’d recommend restarting your environment, checking if the environment variable is properly set. I encountered something similar in Google Colab, restarting the runtime helped.

1 Like

Try

token = os.getenv(<token>)

Not

token = os.environ.get(<token>)
1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.