Connectport X2 and python modules

I’ve tried everything I can find, but no matter what, I get the “no module named …” error when I try to import a module from a zip archive.

I’ve tried the sys.path.append method in the Digi instructions (which are pretty thin in this area), and the sys.path.insert method in the XIG code (which runs without error), but I always get the same error.

Can someone who has made this work provide some guidance here? I’m at the end of my rope.

To be clear, this is my test.py code:

#######################
import sys, zipimport

zip = “WEB/python/test.zip”
if zip in zipimport._zip_directory_cache:
del zipimport._zip_directory_cache[zip]

sys.path.insert(0, zip)

#import sys

#APP_ARCHIVE = “WEB/python/test.zip”
#sys.path.insert(0, APP_ARCHIVE)
#sys.path.append(‘WEB/python/test.zip’)

print sys.path

#import fibo.fib

from fibo import fib, fib2
#################

and this is the fibo.py file in test.zip:

####################

Fibonacci numbers module

def fib(n): # write Fibonacci series up to n
a, b = 0, 1
while b < n:
print b,
a, b = b, a+b

def fib2(n): # return Fibonacci series up to n
result = []
a, b = 0, 1
while b < n:
result.append(b)
a, b = b, a+b
return result
#################

And here is what I get when I run it.

#> python test.py

[‘WEB/python/test.zip’, ‘WEB/python’, ‘WEB/python/python.zip’]
Traceback (most recent call last):
File “”, line 20, in ?
ImportError: No module named fibo

#>

So clearly the path has been modified properly, but for some reason it doesn’t seem to be actually looking in the zip file. When I include fibo.py in the WEB/python directory, it runs fine. Can someone please tell me what I’m missing here?

Thanks in advance.

-Mike-