Frage

Trying to convert my program into an executable that uses anydbm, and am getting this response:

Traceback (most recent call last):
  File "sliceReg.py", line 14, in <module>
  File "registration.pyc", line 3, in <module>
  File "chamfer.pyc", line 4, in <module>
  File "sliceTools.pyc", line 3, in <module>
  File "dbUtils.pyc", line 5, in <module>
  File "anydbm.pyc", line 53, in <module>
ImportError: no dbm clone found; tried ['dbhash', 'gdbm', 'dbm', 'dumbdbm']

After some intense googling my setup.py now looks like :

from distutils.core import setup
import py2exe
import glob
import numpy



opts = {
    'py2exe': { 'includes': ['dbhash', 'anydbm', 'skimage'],
    'excludes': ['_gtkagg', '_tkagg'],
    'dll_excludes': ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll']
                 }
    }   

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

setup(
    data_files = [('Images', glob.glob('Images/*.*')), 
    ('templates', glob.glob('data/templates/*.*'))],
    windows = ['MY_PROGRAM.py']
    )

I also read that I was supposed to maybe add the

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

in the actual .py file that imports anydbm. So I tried that as well, but to no avail. Any ideas? Thanks in advance!

War es hilfreich?

Lösung

Sorry I was wrong, all I had to do was import dbhash along with anydbm at the beginning of the python file. (Not the setup.py)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top