2

Im trying to compile my project for windows. Im on windows 2008 32 bit.

It compiles with no issues but when I try and open the EXE it says it cannot import cefpython_27. The problem is from this file in cefpython in site-packages: (init.py)

import sys

if 0x02070000 <= sys.hexversion < 0x03000000:
    from . import cefpython_py27 as cefpython
elif 0x03000000 <= sys.hexversion < 0x04000000:
    from . import cefpython_py32 as cefpython
else:
    raise Exception("Unsupported python version: " + sys.version)

__version__ = "27.3"
__author__ = "The CEF Python authors"

I suspect the problem is with this line:

from . import cefpython_py27 as cefpython

because that path is not relative to the EXE file.

How should I be importing this?

This is my setup.py file:

from distutils.core import setup
import py2exe, os

def get_cefpython_path():
    from cefpython3 import cefpython
    path = os.path.dirname(cefpython.__file__)
    return "%s%s" % (path, os.sep)

def get_data_files():
    cefp = get_cefpython_path()
    data_files = [('', ['%s/icudt.dll' % cefp,
          '%s/d3dcompiler_43.dll' % cefp,
          '%s/devtools_resources.pak' % cefp,
          '%s/ffmpegsumo.dll' % cefp,
          '%s/libEGL.dll' % cefp,
          '%s/libGLESv2.dll' % cefp,
          '%s/Microsoft.VC90.CRT.manifest' % cefp,
          '%s/msvcm90.dll' % cefp,
          '%s/msvcp90.dll' % cefp,
          '%s/msvcr90.dll' % cefp]),
        ('locales', ['%s/locales/en-US.pak' % cefp]),
        ]
    print data_files
    return data_files
setup(
    console=['videoinbox.py'],
    data_files = get_data_files()
)

This is the error trying to open the EXE:

Traceback (most recent call last):
  File "videoinbox.py", line 41, in <module>
    from cefpython3 import cefpython
  File "cefpython3\__init__.pyc", line 4, in <module>
ImportError: cannot import name cefpython_py27

UPDATE

So I have looked at the library.zip file and looked inside the cefpython3 directory. there is only a init.py file. this must be why its complaining. I then tried building that file and It complained so I added the files [cefpython_py27.pyd, icudt.dll] in the same direcotry and then it did run when calling it manually.

Now Im not sure how to get this included from the build of py2exe? But even If I add this to the zip file it still sais its not found. Altough extracting the zip and doing python init.py it works!

Luboš Turek
  • 6,273
  • 9
  • 40
  • 50
Harry
  • 13,091
  • 29
  • 107
  • 167

0 Answers0