Error with Shelve from a frozen application

Josiah Carlson jcarlson at uci.edu
Tue Jan 20 17:09:01 EST 2004


> Hello all,
> 
> I have searched and experimented but can't find a way to make this
> work. I have an application that I froze using py2exe which uses
> Shelve to store data for me. This is the error I am getting:
> 
> Traceback (most recent call last):
>   File "<string>", line 14, in ?
>   File "imputil.pyc", line 103, in _import_hook
>   File "<string>", line 52, in _import_top_module
>   File "imputil.pyc", line 216, in import_top
>   File "imputil.pyc", line 271, in _import_one
>   File "<string>", line 128, in _process_result
>   File "anydbm.pyc", line 62, in ?
> ImportError: no dbm clone found; tried ['dbhash', 'gdbm', 'dbm',
> 'dumbdbm']
> 
> A couple of places mentioned forcing the compiler to import the anydbm
> module. I've tried this both from within the main program and from the
> compiler options. Neither of them worked. Can someone please tell me
> how to fix this?
> 
> Thanks ahead of time,
> Marc

I've had similar problems with attempting to force encodings imports.

At the beginning of your script, give the following a try:

for i in ['dbhash', 'gdbm', 'dbm', 'dumbdbm']:
    try: eval('import '+i)
    except: pass

Send it through py2exe, and give it a shot.

 - Josiah




More information about the Python-list mailing list