# Can't import repackaged .apkg files

**URL:** <https://forums.ankiweb.net/t/cant-import-repackaged-apkg-files/2746>\
**Category:** Development\
**Created:** [August 28, 2020, 12:23am UTC](https://forums.ankiweb.net/t/cant-import-repackaged-apkg-files/2746 "2020-08-28T00:23:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![matrix303](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@matrix303](https://forums.ankiweb.net/u/matrix303)\
**Post date:** [August 28, 2020, 12:23am UTC](https://forums.ankiweb.net/t/cant-import-repackaged-apkg-files/2746/1 "2020-08-28T00:23:25Z")

</div>

So from what I understand, a .apkg file is essentially a zip file. That means that I can access a .apkg file by renaming it to .zip, decompressing it and then able to see the media and collection sqlite3 database.

The problem is when I repackage the file. So if I compress the extracted folder (without any changes), I cant reimport it, the following error is there. This is compressing using the mac’s built in compressor as well as the same python zip file config in the anki export.py code (zipfile.ZipFile(‘Python.apkg’, ‘w’, zipfile.ZIP\_DEFLATED, allowZip64=True)". Please let me know why this is happening and how to resolve it.

 ![Screen Shot 2020-08-27 at 8.22.03 PM](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/b/b4ca9e67241e98f4acf72e8e519dc17da9564a92.png)

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [August 28, 2020, 3:49am UTC](https://forums.ankiweb.net/t/cant-import-repackaged-apkg-files/2746/2 "2020-08-28T03:49:47Z")

</div>

If you compare the two zip files in a zip editor the problem should become apparent.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [May 1, 2023, 3:25am UTC](https://forums.ankiweb.net/t/cant-import-repackaged-apkg-files/2746/3 "2023-05-01T03:25:30Z")

</div>

Closed on May 1, 2023, 3:25am UTC


