Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cant save html/image #2

Open
clearlyqt opened this issue Dec 13, 2023 · 2 comments
Open

cant save html/image #2

clearlyqt opened this issue Dec 13, 2023 · 2 comments

Comments

@clearlyqt
Copy link

error and crashes when trying to save html/image

Caught exception:
Traceback (most recent call last):
File "C:\Users\xxxxxx\AppData\Roaming\Anki2\addons21\1469765093_init_.py", line 290, in
sh = QPushButton("Save HTML", clicked=lambda: self.savehtml(config))
File "C:\Users\xxxxxx\AppData\Roaming\Anki2\addons21\1469765093_init_.py", line 302, in savehtml
fileName = QFileDialog.getSaveFileName(self.win, "Save Page", QStandardPaths.standardLocations(QStandardPaths.DesktopLocation)[0], "Web Page (*.html *.htm)")[0]
AttributeError: type object 'QStandardPaths' has no attribute 'DesktopLocation'

@clearlyqt
Copy link
Author

clearlyqt commented Dec 30, 2023

found a workaround, if i just delete the QStandardPaths.standardLocation(QStandardPaths.DesktopLocation) from line 302 it allows me to save the html anywhere, if i remove it in 315 its still broken for the image though

@BigBoyBarney
Copy link

BigBoyBarney commented May 5, 2024

Can confirm this change fixes the export issue for me as well, using:

  • Anki 24.04.1 (Flatpak version)
  • Fedora 39

Starting from line 301:

[…]
def savehtml(self, config):
+	fileName = QFileDialog.getSaveFileName(self.win, "Save Page", "Web Page (*.html *.htm)")[0]
-	fileName = QFileDialog.getSaveFileName(self.win, "Save Page",QStandardPaths.standardLocation(QStandardPaths.DesktopLocation)[0], "Web Page (*.html *.htm)")[0]
        if fileName != "":
[…]

Maybe this change breaks something else, but so far I haven't encountered any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants