简体   繁体   中英

anaconda-navigator not running after a abrupt shutdown

I was running anaconda-navigator in the past days. My system was abruptly shutdown one day. After that, when I run anaconda-navigator, it is showing the following error

dstlab2@dstlab2-Veriton-M200-H81:~$ anaconda-navigator
    Traceback (most recent call last):
      File "/home/dstlab2/anaconda3/bin/anaconda-navigator", line 11, in <module>
        sys.exit(main())
      File "/home/dstlab2/anaconda3/lib/python3.7/site-packages/anaconda_navigator/app/main.py", line 99, in main
        from anaconda_navigator.utils.logs import clean_logs
      File "/home/dstlab2/anaconda3/lib/python3.7/site-packages/anaconda_navigator/utils/logs.py", line 18, in <module>
        from anaconda_navigator.config import (LOG_FILENAME, LOG_FOLDER,
      File "/home/dstlab2/anaconda3/lib/python3.7/site-packages/anaconda_navigator/config/__init__.py", line 27, in <module>
        from anaconda_navigator.config.main import CONF
      File "/home/dstlab2/anaconda3/lib/python3.7/site-packages/anaconda_navigator/config/main.py", line 71, in <module>
        raw_mode=True,
      File "/home/dstlab2/anaconda3/lib/python3.7/site-packages/anaconda_navigator/config/user.py", line 221, in __init__
        self.load_from_ini()
      File "/home/dstlab2/anaconda3/lib/python3.7/site-packages/anaconda_navigator/config/user.py", line 279, in load_from_ini
        self.read(self.filename(), encoding='utf-8')
      File "/home/dstlab2/anaconda3/lib/python3.7/configparser.py", line 696, in read
        self._read(fp, filename)
      File "/home/dstlab2/anaconda3/lib/python3.7/configparser.py", line 1014, in _read
        for lineno, line in enumerate(fp, start=1):
      File "/home/dstlab2/anaconda3/lib/python3.7/codecs.py", line 322, in decode
        (result, consumed) = self._buffer_decode(data, self.errors, final)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf2 in position 378: invalid continuation byte

can anyone help me how to set things right?

It looks as if a configuration file used by anaconda navigator has been corrupted. The file probably exists in the $HOME/.anaconda folder; it may have a .ini extension.

If you can identify the file, you could try replacing the byte that's causing the problem (make a backup copy of the file first):

>>> with open('config.ini', 'rb+') as f:
...     data = f.read()
...     data = data.replace(b'\xf2', b'')
...     assert data
...     f.seek(0)
...     f.write(data)
... 
0
171

Note that there may be more than one byte.

It's also possible that the file has been truncated or corrupted so much that it needs to be deleted or replaced entirely.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM