Re: [python-win32] Problem with msvcr90.dll

2011-03-02 Thread Aahz
On Tue, Feb 01, 2011, Tefnet Developers wrote:

 $ make pytest.exe
 i586-mingw32msvc-gcc -I./include -I./include/python -Wall -pedantic
 -std=c99-c -o pytest.o pytest.c
 i586-mingw32msvc-gcc -L./lib -o pytest.exe pytest.o -lmingw32 -lpython26
 rm pytest.o
 
 The output looks like this:
 
 C:\pytest
 Traceback (most recent call last):
   File string, line 3, in module
   File C:\Python26\lib\site-packages\win32\lib\pywintypes.py, line
 124, in module
 __import_pywin32_system_module__(pywintypes, globals())
   File C:\Python26\lib\site-packages\win32\lib\pywintypes.py, line 64,
 in __import_pywin32_system_module__
 import _win32sysloader
 ImportError: DLL load failed: The specified module could not be found

What happens if you use VC++ 2008 Express?  (Yes, that should not
change anything, but I've seen people report all kinds of weird problems
with mingw.)
-- 
Aahz (a...@pythoncraft.com)   * http://www.pythoncraft.com/

Programming language design is not a rational science. Most reasoning
about it is at best rationalization of gut feelings, and at worst plain
wrong.  --GvR, python-ideas, 2009-03-01
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Problem with msvcr90.dll

2011-03-02 Thread Mark Hammond

On 2/02/2011 3:11 AM, Tefnet Developers wrote:

Dnia 2011-02-01, wto o godzinie 10:44 +1100, Mark Hammond pisze:

This stuff is painful and poorly documented.  Is it possible the code
which triggers the failing import is on a different thread than the one
which loaded Python?  If so, I suspect the magic done by Python in
dl_nt.c may not be kicking in, which is supposed to ensure all python
modules are loaded using the activation context defined by pythonxx.dll.


The smallest piece of program that shows the problem:

$ cat pytest.c
#includePython.h


int main(void) {
 Py_Initialize();
 PyRun_SimpleString(
 import traceback \n
 try:\n
import pywintypes\n
 except:\n
traceback.print_exc()\n
 );
}

$ make pytest.exe
i586-mingw32msvc-gcc -I./include -I./include/python -Wall -pedantic
-std=c99-c -o pytest.o pytest.c

i586-mingw32msvc-gcc -L./lib -o pytest.exe pytest.o -lmingw32 -lpython26
rm pytest.o


What happens if you give that executable a manifest referencing the CRT? 
 Note that things changed since pywin32 build 214 - now (almost) none 
of the pywin32 pyd files have a manifest at all, meaning they can be 
loaded correctly by Python itself in all cases - but the thing that 
loads Python *must* have a manifest - ie, python.exe needs (and has) 
one, as does the DLL which loads Python COM objects.  It gets even more 
complicated if Python is loaded via LoadLibrary - you can check the 
source to pythoncomloader in the pywin32 repo for more details (the 
short version is that the same hacks that Python itself does WRT 
activation contexts needs to be done...)


Aahz's suggestion is a good one - you should use the VC compiler as your 
baseline, then try and get mingw going one you have initial success 
with VC.


HTH,

Mark
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Problem with msvcr90.dll

2011-03-02 Thread Tim Roberts
Mark Hammond wrote:

 What happens if you give that executable a manifest referencing the CRT? 
  Note that things changed since pywin32 build 214 - now (almost) none 
 of the pywin32 pyd files have a manifest at all, meaning they can be 
 loaded correctly by Python itself in all cases - but the thing that 
 loads Python *must* have a manifest - ie, python.exe needs (and has) 
 one, as does the DLL which loads Python COM objects.  It gets even more 
 complicated if Python is loaded via LoadLibrary - you can check the 
 source to pythoncomloader in the pywin32 repo for more details (the 
 short version is that the same hacks that Python itself does WRT 
 activation contexts needs to be done...)

Let us HOPE that Python quickly migrates to Visual Studio 2010, in which
the team has wisely decided to abandon the side-by-side stuff altogether
and go back to a simpler way of life, where having the files in
\Windows\System32 is enough for everyone.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32