pythonpy2execonfigparserbackport

Py2exe and ConfigParser Error


I'm using Py2exe and ConfigParser but I have somo problems.

I have installed configparser from pip (pip install configparser) and it works fine. In my code I import the package like this import ConfigParser and when I execute works.

Now I have used py2exe to make a distribution and the output console message is: The following modules appear to be missing ['Carbon', 'Carbon.Files', '_sysconfigdata', 'backports.configparser']

When I have executed the .exe file, the error message is: File "GUI.py", line 14, in <module> File "configparser.pyc", line 12, in <module> ImportError: No module named backports.configparser

I tried use other kind of import like: from backports import configparser or import backports, backports.configparser

And the results are the same.

My setup.py file:

from distutils.core import setup
import py2exe


opts = {
'py2exe': { 'includes' : ["sys","sip", "time", "decimal"],
            'excludes': ['_gtkagg', '_tkagg', '_agg2', '_cairo', '_cocoaagg','_fltkagg', '_gtk', '_gtkcairo'],
            'dll_excludes': ['oci.dll','libgdk-win32-2.0-0.dll','libgobject-2.0-0.dll']}
   }

data_files=[]
setup(
  name='Actualizador',
  version='1.0',
  package={'./img/*', './campos/*'},
  scripts=['GUI.py'],
  console=['GUI.py'],
  #windows=["GUI.py"],
  options=opts,
  data_files=data_files,
  zipfile=None
  )

I can't make my distribution and I can't solve my issue. Any suggestion?

Thank You


Solution

  • I solved the problem :-)

    py2exe use the directory build to skip the compilation for some package which are yet compiled. Well, I remove the directory, I add the backports path to system path and I make the distribution again. And magic! That works ...