question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

apy --help gives "Exception: couldn't find web folder"

See original GitHub issue

I’m running Manjaro Linux. I installed apy using pipx. My anki is installed with pacman, but the source wasn’t in /usr/share/anki/. Instead it looks as though it’s in /usr/lib/python3.8/site-packages/ – at least, there are directories for anki, aqt, and ankirspy in there. So I do export APY_ANKI_PATH=/usr/lib/python3.8/site-packages/

However when I run apy --help I get this output:

reverting to stock json
Traceback (most recent call last):
  File "/home/ckp95/.local/bin/apy", line 5, in <module>
    from apy.cli import main
  File "/home/ckp95/.local/pipx/venvs/apy/lib/python3.8/site-packages/apy/cli.py", line 6, in <module>
    from apy.anki import Anki
  File "/home/ckp95/.local/pipx/venvs/apy/lib/python3.8/site-packages/apy/anki.py", line 10, in <module>
    from aqt.profiles import ProfileManager
  File "/usr/lib/python3.8/site-packages/aqt/__init__.py", line 35, in <module>
    from aqt.main import AnkiQt  # isort:skip
  File "/usr/lib/python3.8/site-packages/aqt/main.py", line 21, in <module>
    import aqt.mediasrv
  File "/usr/lib/python3.8/site-packages/aqt/mediasrv.py", line 31, in <module>
    _exportFolder = _getExportFolder()
  File "/usr/lib/python3.8/site-packages/aqt/mediasrv.py", line 28, in _getExportFolder
    raise Exception("couldn't find web folder")
Exception: couldn't find web folder

I dug around in the mediasrv.py file and found this as the culprit function:

def _getExportFolder():
    data_folder = aqt_data_folder()
    webInSrcFolder = os.path.abspath(os.path.join(data_folder, "web"))
    if os.path.exists(webInSrcFolder):
        return webInSrcFolder
    elif isMac:
        dir = os.path.dirname(os.path.abspath(__file__))
        return os.path.abspath(dir + "/../../Resources/web")
    else:
        raise Exception("couldn't find web folder")


_exportFolder = _getExportFolder()

I stuck a print(data_folder) debug statement in there and ran apy --help again, this is what I got:

/usr/lib/python3.8/site-packages/aqt/../aqt_data

Any idea how to fix?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
lervagcommented, Jun 5, 2020

I’m not happy with this solution but it does work.

Sorry about that! If you find a way to make this work reliably when installed in a venv, then please let me know!

0reactions
ckp95commented, Jun 5, 2020

Nevermind, I just installed it on my system Python rather than a pyenv one. I’m not happy with this solution but it does work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

11 Ways to Fix "The System Cannot Find The Path ...
1. Run Command Prompt as an Administrator ... Windows utilities cannot access all files and folders available on your device. Administrative ...
Read more >
Could not find default endpoint element
NET 3.5 solution. When constructing the client .NET throws this error: Could not find default endpoint element that references contract 'IMySOAPWebService' in ...
Read more >
Fixed: "Procedure Entry Point Could Not Be Located" Error
Open the search bar in your taskbar, and then type Command Prompt in the search box. · Click Yes if prompted. · Type...
Read more >
Java Guide: How to Fix "Could not find or load main class"
The Java “Could not find or load main class” error is thrown when the JVM fails to find or load the main class...
Read more >
Telerik RadControls How To Fix License File Related Errors
Could not load file or assembly · remove the reference to Telerik.Web.UI.dll in Visual Studio and re-add it. · clean the Temporary ASP.NET...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found