PROBLEM STARTING - Anki could not create its data folder

When I open Anki, it says: anki could not create its data folder…
and I can’t solve it. Please see…

[5540] PyInstaller Bootloader 3.x
[5540] LOADER: executable is C:\Program Files\Anki\anki-console.exe
[5540] LOADER: homepath is C:\Program Files\Anki
[5540] LOADER: _MEIPASS2 is NULL
[5540] LOADER: archivename is C:\Program Files\Anki\anki-console.exe
[5540] LOADER: C:\Program Files\Anki\anki-console.exe contains a digital signature
[5540] LOADER: No need to extract files to run; setting extractionpath to homepath
[5540] LOADER: SetDllDirectory(C:\Program Files\Anki)
[5540] LOADER: Already in the child - running user’s code.
[5540] LOADER: Python library: C:\Program Files\Anki\python38.dll
[5540] LOADER: Loaded functions from Python library.
[5540] LOADER: Manipulating environment (sys.path, sys.prefix)
[5540] LOADER: sys.prefix is C:\Program Files\Anki
[5540] LOADER: Pre-init sys.path is C:\Program Files\Anki\base_library.zip;C:\Program Files\Anki
[5540] LOADER: Setting runtime options
[5540] LOADER: Initializing python
[5540] LOADER: Overriding Python’s sys.path
[5540] LOADER: Post-init sys.path is C:\Program Files\Anki\base_library.zip;C:\Program Files\Anki
[5540] LOADER: Setting sys.argv
[5540] LOADER: setting sys.MEIPASS
[5540] LOADER: importing modules from CArchive
[5540] LOADER: extracted struct
[5540] LOADER: callfunction returned…
[5540] LOADER: extracted pyimod01_os_path
[5540] LOADER: callfunction returned…
[5540] LOADER: extracted pyimod02_archive
[5540] LOADER: callfunction returned…
[5540] LOADER: extracted pyimod03_importers
[5540] LOADER: callfunction returned…
[5540] LOADER: Installing PYZ archive with Python modules.
[5540] LOADER: PYZ archive: PYZ-00.pyz
[5540] LOADER: Running pyiboot01_bootstrap.py
[5540] LOADER: Running pyi_rth_win32comgenpy.py
[5540] LOADER: Running pyi_rth_multiprocessing.py
[5540] LOADER: Running pyi_rth_certifi.py
[5540] LOADER: Running pyi_rth_pyqt5.py
[5540] LOADER: Running pyi_rth_pkgres.py
[5540] LOADER: Running pyi_rth_pyqt5webengine.py
[5540] LOADER: Running runanki.py
Traceback (most recent call last):
File "aqt_init
.py", line 497, in _run
File “aqt\profiles.py”, line 130, in init
File “aqt\profiles.py”, line 432, in _setBaseFolder
File “aqt\profiles.py”, line 175, in maybeMigrateFolder
File “aqt\profiles.py”, line 166, in _oldFolderLocation
File “aqt\winpaths.py”, line 163, in get_personal
File “aqt\winpaths.py”, line 105, in _get_path_buf
File “aqt\winpaths.py”, line 89, in _err_unless_zero
aqt.winpaths.WinPathsException: Failed to retrieve windows path: -2147024894

The error code is a bit different this time but it should be the same case.

Your system seems to have CSIDL_PERSONAL / My Documents pointing to an invalid path.

A brief Google surfaces the following: System call to get the 'My Documents' folder failed | Legacy Family Tree

Source: https://anki.tenderapp.com/discussions/ankidesktop/38165-anki-wont-start-cannot-create-data-folder#comment_48018206

For Windows 10 maybe try https://www.tenforums.com/tutorials/23504-restore-default-location-personal-folders-windows-10-a.html

Alternatively, to ignore this error, start Anki with -b option.

"C:\Program Files\Anki\anki.exe" -b "%APPDATA%\Anki2"

https://docs.ankiweb.net/files.html#startup-options
https://docs.ankiweb.net/files.html#file-locations

3 Likes

Consegui!!! muito obrigado!