Anki can't work with: 'AnkiQt' object has no attribute 'flags'

Error
An error occurred. Please use Tools > Check Database to see if that fixes the problem.
If problems persist, please report the problem on our support site. Please copy and paste the information below into your report.
Anki 2.1.51 (cf78a555) Python 3.9.7 Qt 5.15.2 PyQt 5.15.5
Platform: Windows 10
Flags: frz=True ao=False sv=2
Add-ons, last update check: 2022-06-01 18:08:20

Caught exception:
Traceback (most recent call last):
File “aqt.webview”, line 42, in cmd
File “aqt.webview”, line 149, in _onCmd
File “aqt.webview”, line 618, in _onBridgeCmd
File “aqt.toolbar”, line 168, in _linkHandler
File “aqt.toolbar”, line 186, in _browseLinkHandler
File “aqt.main”, line 1129, in onBrowse
File “aqt”, line 129, in open
File “aqt.browser.browser”, line 133, in init
File “aqt.browser.browser”, line 232, in setupMenus
AttributeError: ‘AnkiQt’ object has no attribute ‘flags’

Did you rule out add-ons? Please see When problems occur - Frequently Asked Questions

My guess is that this is caused by an add-on that changes profile loading (specifically patches the loadProfile function). Check if you have any of the following add-ons:

https://ankiweb.net/shared/info/978789253
https://ankiweb.net/shared/info/768963681
https://ankiweb.net/shared/info/262508408
https://ankiweb.net/shared/info/1832015432
https://ankiweb.net/shared/info/1786818696
https://ankiweb.net/shared/info/162231225
https://ankiweb.net/shared/info/1602224446
https://ankiweb.net/shared/info/1233908746

4 Likes

If you have already tried the steps on that page and are still having trouble, are you getting any other error messages that appear first?

Hey,thanks.
I have solute it by reinstall, I will try it in next time.

I have checked that I haven’t add any add-ons in my Anki.
Today when I try to sync my anki again and it said:

An error occurred. Please use Tools > Check Database to see if that fixes the problem.

If problems persist, please report the problem on our [support site](https://help.ankiweb.net). Please copy and paste the information below into your report.

Anki 2.1.53 (96bacf79) Python 3.9.7 Qt 6.3.0 PyQt 6.3.0

Platform: Windows 10

Flags: frz=True ao=False sv=2

Add-ons, last update check: 2022-06-05 14:49:00

Caught exception:

Traceback (most recent call last):

File "aqt.main", line 253, in on_focus_changed

File "aqt.hooks_gen", line 2766, in __call__

File "aqt.main", line 750, in on_focus_did_change

File "aqt.reviewer", line 170, in refresh_if_needed

File "aqt.reviewer", line 229, in nextCard

AttributeError: 'Reviewer' object has no attribute '_reps'

then I trid to use Tools > Check Database to fix it, my anki said:

An error occurred. Please use Tools > Check Database to see if that fixes the problem.
If problems persist, please report the problem on our support site. Please copy and paste the information below into your report.
Anki 2.1.53 (96bacf79) Python 3.9.7 Qt 6.3.0 PyQt 6.3.0
Platform: Windows 10
Flags: frz=True ao=False sv=2
Add-ons, last update check: 2022-06-05 14:49:00

Caught exception:
Traceback (most recent call last):
  File "aqt.taskman", line 122, in _on_closures_pending
  File "aqt.taskman", line 71, in <lambda>
  File "aqt.taskman", line 90, in wrapped_done
  File "aqt.dbcheck", line 41, in on_future_done
  File "concurrent.futures._base", line 438, in result
  File "concurrent.futures._base", line 390, in __get_result
  File "concurrent.futures.thread", line 52, in run
  File "aqt.dbcheck", line 36, in do_check
  File "aqt.main", line 1384, in create_backup_now
  File "anki.collection", line 360, in create_backup
  File "anki._backend.generated", line 1778, in create_backup
  File "anki._backend", line 146, in _run_command
anki.errors.BackendIOError: IoError("Custom { kind: PermissionDenied, error: PathError { path: \"C:\\\\Users\\\\faye\\\\AppData\\\\Local\\\\Temp\\\\.tmpJQfZW2\", err: Os { code: 5, kind: PermissionDenied, message: \"拒绝访问。\" } } }")

“拒绝访问” meaning “Access denied” so I went to this document and I cant find any text called: .tmpJQfZW2

the next time I try to open anki it says:

An error occurred. Please use Tools > Check Database to see if that fixes the problem.
If problems persist, please report the problem on our support site. Please copy and paste the information below into your report.
Anki 2.1.53 (96bacf79) Python 3.9.7 Qt 6.3.0 PyQt 6.3.0
Platform: Windows 10
Flags: frz=True ao=False sv=2
Add-ons, last update check: 2022-06-05 14:49:00

Caught exception:
Traceback (most recent call last):
  File "D:\Program Files\Anki\lib\win32com\client\gencache.py", line 60, in __init__
    _LoadDicts()
  File "D:\Program Files\Anki\lib\win32com\client\gencache.py", line 116, in _LoadDicts
    f = open(os.path.join(win32com.__gen_path__, "dicts.dat"), "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\faye\\AppData\\Local\\Temp\\gen_py\\3.9\\dicts.dat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Program Files\Anki\lib\win32com\client\gencache.py", line 151, in GetGeneratePath
    os.stat(fname)
FileNotFoundError: [WinError 3] 系统找不到指定的路径。: 'C:\\Users\\faye\\AppData\\Local\\Temp\\gen_py\\3.9\\__init__.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "aqt.progress", line 118, in handler
  File "aqt.main", line 197, in on_window_init
  File "aqt.main", line 243, in setupProfileAfterWebviewsLoaded
  File "aqt.main", line 290, in setupProfile
  File "aqt.main", line 450, in loadProfile
  File "aqt.main", line 525, in setup_sound
  File "aqt.sound", line 867, in setup_audio
  File "aqt.tts", line 269, in <module>
  File "D:\Program Files\Anki\lib\win32com\client\__init__.py", line 11, in <module>
    from . import gencache
  File "D:\Program Files\Anki\lib\win32com\client\gencache.py", line 761, in <module>
    __init__()
  File "D:\Program Files\Anki\lib\win32com\client\gencache.py", line 62, in __init__
    Rebuild()
  File "D:\Program Files\Anki\lib\win32com\client\gencache.py", line 746, in Rebuild
    _SaveDicts()
  File "D:\Program Files\Anki\lib\win32com\client\gencache.py", line 73, in _SaveDicts
    f = open(os.path.join(GetGeneratePath(), "dicts.dat"), "wb")
  File "D:\Program Files\Anki\lib\win32com\client\gencache.py", line 153, in GetGeneratePath
    f = open(fname, "w")
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\faye\\AppData\\Local\\Temp\\gen_py\\3.9\\__init__.py'

plz help me :sob: :sob: :sob: :sob:

Looks like a problem with permissions. Please see Managing Files - Anki Manual

3 Likes

No, It’s not worked.
It still show about it’s have problem of “gen_py\3.9\init.py” or "Access denied"
I gusee maybe it’s have some problem with my python (version 3.9) but I don’t know how to slove it.

Besides, I would recommend opening on thread per issue you have, instead of having a single long thread with all your issues. This is to ease future readers who will look up for a solution to a given problem (which can be hard if a single thread contains both information about their problem, and information about something else).

I’m sorry about that but this is what happened in order when I open my Anki

I suspect they are related, and the root cause of the original error is the temp permissions.

@dachinz if you’re still getting errors, that seems to imply there is still a problem with your C:\\Users\\faye\\AppData\\Local\\Temp folder. Maybe someone around you who is good with Windows will be able to help.

I try go give users group a highest authority and it looks worked now.
danke very much

Ah ok my bad, I though it was a different issue. No problem then! :slight_smile: