zipimport.ZipImportError: bad local file header

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/

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?

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:

A few weeks ago someone added this info to the Digi Dev Wiki:'s_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.

The method described in the wiki works.