Ambriel / advanced_copy_fields

Anki 2.0+ Plugin for performing various field copy/move operations
3 stars 1 forks source link

AttributeError: type object 'QTextCursor' has no attribute 'End' #6

Open gerhard4 opened 10 months ago

gerhard4 commented 10 months ago

I get the error below when I do the following:

  1. Open card browser
  2. Right-click on a card
  3. Click on "Advanced Copy..."
  4. Select "Custom" in the "Action" field.

The actual copy functionality doesn't seem to be affected, but the "Source Field" and the "Template" of the dialog don't look quite right: image

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue to the add-on author.
Debug info:
Anki 23.10.1 (fac9e0ee) Python 3.9.15 Qt 6.6.0 PyQt 6.6.0
Platform: Windows-10-10.0.22621
Flags: frz=True ao=True sv=3
Add-ons, last update check: 2023-12-27 11:49:10
Add-ons possibly involved: ⁨Advanced Copy Fields⁩

Caught exception:
Traceback (most recent call last):
  File "C:\Users\...\AppData\Roaming\Anki2\addons21\1898445115\advanced_copy_fields.py", line 433, in onActionIndexChange
    self.onCustom()
  File "C:\Users\...\AppData\Roaming\Anki2\addons21\1898445115\advanced_copy_fields.py", line 419, in onCustom
    cursor.movePosition(QtGui.QTextCursor.End)
AttributeError: type object 'QTextCursor' has no attribute 'End'
Ambriel commented 10 months ago

Here is an announcement I put together to tackle this issue.

Please confirm if it worked for you.

gerhard4 commented 10 months ago

Thanks for getting back to me.

The announcement talks about two things:

AIUI, there isn't anything I can do -- my installation already conforms to what the announcement says.

So it seems that this is a different issue.

Yell0whead commented 10 months ago

Hey all,

I know you do this for the love of the community, so I want to thank you for all your work building this add-on! I'm merely adding some info in the hope it helps the project.

I think I came across the same error. I'm using Anki for Mac, and my version data is below. I believe I'm in compliance with your suggestion above, just like @gerhard4. I also reinstalled the add-on, and tried various troubleshooting steps.

Version:

Screenshot 2024-01-03 at 10 10 34 PM

Bug screenshot: image

Debug code: `Anki 23.12.1 (1a1d4d54) (ao) Python 3.9.15 Qt 6.5.3 PyQt 6.5.3 Platform: macOS-14.2.1-arm64-arm-64bit

Traceback (most recent call last): File "/Users/jaredcampbell/Library/Application Support/Anki2/addons21/1898445115/advanced_copy_fields.py", line 433, in onActionIndexChange self.onCustom() File "/Users/jaredcampbell/Library/Application Support/Anki2/addons21/1898445115/advanced_copy_fields.py", line 419, in onCustom cursor.movePosition(QtGui.QTextCursor.End) AttributeError: type object 'QTextCursor' has no attribute 'End'

===Add-ons (active)=== (add-on provided name [Add-on folder, installed at, version, is config changed]) Advanced Copy Fields ['1898445115', 2023-12-21T03:38, 'v1.4', ''] Advanced Review Bottom Bar ['1136455830', 2023-11-17T04:57, 'None', mod] Anki Simulator ['817108664', 2023-11-06T10:26, 'None', ''] Custom Background Image and Gear Icon ['1210908941', 2023-04-18T19:19, 'None', mod] FSRS4Anki Helper ['759844606', 2023-12-31T03:46, 'None', ''] Image Occlusion Enhanced ['1374772155', 2022-04-09T01:15, 'None', ''] Review Heatmap ['1771074083', 2022-06-29T19:43, 'None', '']

===IDs of active AnkiWeb add-ons=== 1136455830 1210908941 1374772155 1771074083 1898445115 759844606 817108664

===Add-ons (inactive)=== (add-on provided name [Add-on folder, installed at, version, is config changed]) Puppy Reinforcement ['1722658993', 2023-11-16T05:59, 'None', ''] `

Ambriel commented 10 months ago

Hi there. I will upload the update soon. However, I have reason to believe there is some kind of breakdown going on with the addon you have installed because advanced_copy_fields.py the latest version does not have any reference to advanced_copy_fields.py. The new files are only advanced_copy_fields_qt5.py and advanced_copy_fields_qt6.py. So based on that, it's reading from a prior version. Not sure if the pycache folder needs to be emptied or not.

That said, the error will still happen just based on the code for qt6 so I'll make that adjustment and try to have that uploaded by EOD.

Yell0whead commented 10 months ago

Hey Ambriel!

Impressed you replied so soon. I tried both deleting and redownloaded the add-on, and emptying the pycache folder. It still references the advanced_copy_fields.py file like you pointed out. Not sure why.

Appreciate any fix if you push it out!

Ambriel commented 10 months ago

It may be possible that you have two different versions with different names in your addon folder. Have you tried restarting ANKI after you deleted the folder to ensure there are no more references to the addon in the addons folder?

Ambriel commented 10 months ago

@JaredBCampbell Can you please give me feedback on the latest release to see if it the issue has been resolved?

Yell0whead commented 5 months ago

Hey @Ambriel!

Apologies for not replying back in January; I've been recently working on some things in Anki and remembered our conversation.

I redownloaded Advanced Copy and now see that the issue has been resolved with your update. It looks great! Thanks for your hard work.

gerhard4 commented 4 months ago

Sorry for not getting back earlier. My issue seems to be resolved; I don't see it happening anymore. As far as I'm concerned, this issue can be closed. (I just don't close it because I don't know what your process is with this.)