rdmenezes / cefpython

Automatically exported from code.google.com/p/cefpython
1 stars 0 forks source link

cefpython 0.48 doesn't work on portable python 2.7.3.1 on windows #39

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Portable Python is a convenient way to distribute python applications across 
Windows users, as there's no need to pre-install anything in advance (including 
PyWin32). However, CEF 0.48 doesn't run on Portable Python environment due to 
lack of some C libraries.

To reproduce: please, get a Portable Python at 
http://www.portablepython.com/wiki/PortablePython2.7.3.1, extract it and try to 
execute cefpython on it.

OS: Windows XP, Windows 7

Original issue reported on code.google.com by eugeny.blokhin@gmail.com on 5 Dec 2012 at 11:36

GoogleCodeExporter commented 9 years ago
It might be related to issue 37.

Original comment by czarek.t...@gmail.com on 6 Dec 2012 at 12:11

GoogleCodeExporter commented 9 years ago
Portable Python seem to distribute wrong DLLs also, go to Portable Python\App\, 
in Microsoft.VC90.CRT you will see version string "9.0.21022.8". See file 
msvcr90.dll that this manifest points to, right click and from context menu 
select Properties, then go to Details tab, you will see the version string 
"9.00.30729.61". When you search for "manifest" string in python.exe you will 
find a manifest xml that points to "9.0.21022.8" version of C runtime library.

In the next few days I will make a new release that will include C runtime 
version 9.0.21022.8, if you copy them to Portable Python\App\ and overwrite the 
ones that exist there, the problem should be fixed I think, though you should 
report it also to Portable Python developers to let them know they distribute 
the wrong version of C runtime libraries.

I am attaching "visual_c_runtime_9.0.21022.8.zip", extract them to Portable 
python\App\ and overwrite files, let me know if this fixes the problem (not so 
100% sure as there still might be some conflict because the manifest embedded 
in cefpython_py27.pyd points to 9.00.30729.61 version).

I couldn't reproduce the problem on my machine, windows 7 64bit, possibly 
because I have many c runtime libraries available in Windows\winsxs.

Original comment by czarek.t...@gmail.com on 6 Dec 2012 at 2:10

Attachments:

GoogleCodeExporter commented 9 years ago
Unfortunately, this didn't solve the problem. I always get an "ImportError: DLL 
load failed: The specified module could not be found." on the following lines 
of "imports.pyx":

from libcpp cimport bool as cbool
from libcpp.map cimport map
from libcpp.vector cimport vector

BTW file imports.pyx itself is missing in 0.48 distribution. I got it from git, 
but I am not sure, whether it is really needed. Without it an error doesn't 
point on any cimport, just only:

File "imports.pyx", line 21, in init cefpython_py27 (cefpython.cpp:43489)
ImportError: DLL load failed: The specified module could not be found.

Original comment by eugeny.blokhin@gmail.com on 6 Dec 2012 at 11:50

GoogleCodeExporter commented 9 years ago
Line 21 in imports.pyx is:

    import win32con

Looks like a problem with PyWin32 module.

The "imports.pyx" is used when building the PYD module, it is not meant to be 
distributed along with binaries.

Try editing "cefadvanced.py" or "cefsimple.py" example and add on the top 
following lines:

import win32api
import win32gui
import win32con

Original comment by czarek.t...@gmail.com on 7 Dec 2012 at 12:17

GoogleCodeExporter commented 9 years ago
These imports are already in the examples, but let's try to load them before 
loading cefpython module.

Original comment by czarek.t...@gmail.com on 7 Dec 2012 at 12:18

GoogleCodeExporter commented 9 years ago
There is a plan to remove pywin32 dependence from the PYD module, see Issue 38. 
I will try to do it for the next release along with issue 37.

Original comment by czarek.t...@gmail.com on 7 Dec 2012 at 12:21

GoogleCodeExporter commented 9 years ago
Adding "import pywintypes" before all other PyWin32 imports solves the issue. 
Thus now works fine with Portable Python. Thanks!

Original comment by eugeny.blokhin@gmail.com on 8 Dec 2012 at 11:16

GoogleCodeExporter commented 9 years ago
Where did you find this solution to add "import pywintypes" before others? I 
should probably add this to examples. Or maybe just removing the pywin32 
dependence from the PYD module will solve the problem.

Original comment by czarek.t...@gmail.com on 8 Dec 2012 at 11:35

GoogleCodeExporter commented 9 years ago
Is it required to import pywin32 before cefpython?

Original comment by czarek.t...@gmail.com on 8 Dec 2012 at 11:37

GoogleCodeExporter commented 9 years ago
Yes, importing pywin32 is required at the moment. The solution is found by 
experimenting, based on the last answer at stackoverflow 
(http://stackoverflow.com/questions/3956178/cant-load-pywin32-library-win32gui)

Original comment by eugeny.blokhin@gmail.com on 13 Dec 2012 at 3:19

GoogleCodeExporter commented 9 years ago
I have reproduced the error:

    Traceback (most recent call last):
      File "C:\cefpython\cefpython\cefpython\cef1\windows\binaries\cefadvanced.py", line 14, in <module>
         import cefpython_py27 as cefpython
      File "imports.pyx", line 17, in init cefpython_py27 (cefpython.cpp:46083)
    ImportError: DLL load failed: The specified module could not be found.

Source of that line:

    import win32api

I was able to reproduce it after I deleted 3 files from the system32 directory:

    pythoncom27.dll
    pythoncomloader27.dll
    pywintypes27.dll

These dlls were copied to the system directory while installing pywin32 
extension.

When I copy cefpython binaries to "c:\Portable Python 2.7.3.1\App\" and in that 
folder run "python.exe cefadvanced.py" the cefpython works fine, the DLLs above 
exist in the App\ folder and they load fine, just make sure that 
pywintypes27.dll and other dlls are in the same folder as cefpython.pyd.

Are you using the latest portable python 2.7.3.1? Did you make sure that these 
dlls exist in App\ folder? Did you copy cefpython binaries to the App\ folder? 
Are you sure that you did run python from that App\ folder, and not some other 
in your system PATH?

I will test Portable Python on other computers that had no python installed 
ever.

Original comment by czarek.t...@gmail.com on 13 Dec 2012 at 5:36

GoogleCodeExporter commented 9 years ago
I've tested Portable python 2.7.3.1 + cefpython on 4 machines in total (3x Win 
7, 1x XP) and it works fine, 3 of these machines had never python installed on 
them.

When installing portable python you have to check "PyWin32" module, next copy 
cefpython binaries to Portable Python\App\ folder, run "python.exe 
cefadvanced.py" from that directory, make sure that "pywintypes27.dll" and 
other dlls exist in App\ folder.

I'm marking this issue as invalid, as this is most likely some mistake on your 
side.

Original comment by czarek.t...@gmail.com on 13 Dec 2012 at 6:55

GoogleCodeExporter commented 9 years ago
Resolving Issue 38 will definitely get rid of any problems with the pywin32 
module dependence.

Original comment by czarek.t...@gmail.com on 13 Dec 2012 at 7:23

GoogleCodeExporter commented 9 years ago
Version 0.49 of cefpython released, it fixes Issue 38.

Original comment by czarek.t...@gmail.com on 15 Dec 2012 at 3:13