# zipimport.ZipImportError: bad local file header

**URL:** <https://forums.digi.com/t/zipimport-zipimporterror-bad-local-file-header/2891>\
**Category:** Python\
**Created:** [October 20, 2009, 2:36pm UTC](https://forums.digi.com/t/zipimport-zipimporterror-bad-local-file-header/2891 "2009-10-20T14:36:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobshort](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@bobshort](https://forums.digi.com/u/bobshort)\
**Post date:** [October 20, 2009, 2:36pm UTC](https://forums.digi.com/t/zipimport-zipimporterror-bad-local-file-header/2891/1 "2009-10-20T14:36:33Z")

</div>

I have all my code in modules packaged up into a zip file.

When I run my script, then make changes and upload a new zip file, any attempts to re-run the script result in a zip error:

Traceback (most recent call last):  
File “”, line 6, in ?  
zipimport.ZipImportError: bad local file header in WEB/python/mymodule.zip

Once I reboot the gateway everything works again. This is making development very painful because I have to reboot the gateway every time a make a change.

Does anyone know of a way around this?

---

<div class="post-metadata">

**Author:** ![52637p](https://avatars.discourse-cdn.com/v4/letter/5/c6cbf5/32.png) [@52637p](https://forums.digi.com/u/52637p)\
**Post date:** [October 20, 2009, 2:53pm UTC](https://forums.digi.com/t/zipimport-zipimporterror-bad-local-file-header/2891/2 "2009-10-20T14:53:27Z")

</div>

I believe that this is one of that known limitations of the system. See this page on the Digi developer site for brief notes on this and other common errors:

[http://www.digi.com/wiki/developer/index.php/Error\_messages](http://www.digi.com/wiki/developer/index.php/Error_messages)

---

<div class="post-metadata">

**Author:** ![lynnl](https://avatars.discourse-cdn.com/v4/letter/l/22d042/32.png) [@lynnl](https://forums.digi.com/u/lynnl)\
**Post date:** [October 20, 2009, 3:07pm UTC](https://forums.digi.com/t/zipimport-zipimporterror-bad-local-file-header/2891/3 "2009-10-20T15:07:40Z")

</div>

A few weeks ago someone added this info to the Digi Dev Wiki:  
[http://www.digi.com/wiki/developer/index.php/Digi\_Python\_Programmer's\_Guide#Loading\_Python\_Programs\_onto\_a\_Digi\_Device](http://www.digi.com/wiki/developer/index.php/Digi_Python_Programmer%27s_Guide#Loading_Python_Programs_onto_a_Digi_Device)

It allows the main routine to force a clear & reload the ZIP. I haven’t tried it.

My fix for this is to do heavy “unit test” on a PC of anything not Xbee related, plus even modules geared towards XBee can be split into 2 distinct files, so one can be run part of the code on a PC.

---

<div class="post-metadata">

**Author:** ![bobshort](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@bobshort](https://forums.digi.com/u/bobshort)\
**Post date:** [October 20, 2009, 5:51pm UTC](https://forums.digi.com/t/zipimport-zipimporterror-bad-local-file-header/2891/4 "2009-10-20T17:51:53Z")

</div>

The method described in the wiki works.

Thanks!
