Can't load media in Anki 2.1.35
See original GitHub issueWhen creating a new deck with a set of new cards, running the line my_package.media_files = media_list
, and importing the .apkg file to Anki the media names do appear in the cards fields, but neither the images are shown or the sound is being played, which seems to indicate that my_package.media_files
is not doing its job (here is a sample code that supposedly should work that I also tried: https://gist.github.com/jlumbroso/e17abff02d89be04240072191af09ab2)
It took me a while to realize why my new Anki decks could not show the media files that I wanted to, until I ended up changing my_package.media_files = media_list
with the following function, where media_path is the folder where Anki stores all the media (C:\Users\user\AppData\Roaming\Anki2\User 1\collection.media)
def move_media(media_list, media_path):
for file in media_list:
...destination = media_path + '\\' + os.path.basename(file)
...shutil.move(file, destination)
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top GitHub Comments
Thanks for the help @remiberthoz !!
Environment : Python 3.6.6 genanki 0.10 (I used pip to update it today) Windows Problem : image cannot show on the anki The apkg file:1the picture are in the file 2the media which I open in notebook is right.And I post its context below. {“0”: “21.png”, “1”: “1.png”, “2”: “2.png”, “3”: “3.png”, “4”: “4.png”, “5”: “5.png”, “6”: “6.png”, “7”: “7.png”, “8”: “8.png”, “9”: “9.png”, “10”: “10.png”, “11”: “11.png”, “12”: “12.png”, “13”: “13.png”, “14”: “14.png”, “15”: “15.png”, “16”: “16.png”, “17”: “17.png”, “18”: “18.png”, “19”: “19.png”, “20”: “20.png”} My code is below.
Here is my apkg file.I rename it to upload. newDecks.zip
By the way thanks for your article and your package,Both help me greatly.It is really a fantastic article.