Issue 21825: Embedding-Python example code from documentation crashes
Issue21825
Created on 2014-06-22 15:33 by Pat.Le.Cat, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| main.cpp | Pat.Le.Cat, 2014-06-22 15:33 | Enhanced example from your website | ||
| snakes_bug.jpg | Pat.Le.Cat, 2014-06-22 15:34 | |||
| Messages (5) | |||
|---|---|---|---|
| msg221259 - (view) | Author: Pat Le Cat (Pat.Le.Cat) | Date: 2014-06-22 15:33 | |
When I comment out the Py_SetPath() function call (Line 56), then the code runs up to the 4th test print and then crashes again, possibly at: "Py_XDECREF(pArgs)" else it crashes at Py_Initalize. The same behavior can be observed under Python 3.4.0 and 3.4.1 and on both the MSVC and GCC compiler. BTW: The multiply.py runs fine when called with "py -3" directly. >>Output without Py_SetPath: C:\Development\xxx\Testo1\Snakes\Release>Snakes.exe multiply multiply 3 2 Number of arguments 5 Will compute 3 times 2 Result: 6 ***Test1***Test2***Test3Will compute 3 times 2 ***Test4 >>Output with Py_SetPath: C:\Development\xxx\Testo1\Snakes\Release>Snakes.exe multiply multiply 3 2 Fatal Python error: Py_Initialize: unable to load the file system codec ImportError: No module named 'encodings' **Dev-Environment: Windows 8.1 64bit, MSVC-2013 and MingW (installed with mingw-w64-install.exe downloaded in June 2014). **Microsoft Visual Studio Professional 2013: v12.0.30501.00 Update2 **GCC/G++ Version: C:\Development\xxx\Testo1\Snakes\Release>g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=C:/MingW64/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../../../src/gcc-4.9.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --targe t=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw490/x86_64-490-win32-seh-rt_v3-rev1/mingw64 --wi th-gxx-include-dir=/mingw64/x86_64-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multilib --enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-time=yes --enable-threads=win32 --ena ble-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic -string --enable-version-specific-runtime-libs --disable-isl-version-check --disable-cloog-version-check --dis able-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --dis able-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 - -with-libiconv --with-system-zlib --with-gmp=/c/mingw490/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/ c/mingw490/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw490/prerequisites/x86_64-w64-mingw32-sta tic --with-isl=/c/mingw490/prerequisites/x86_64-w64-mingw32-static --with-cloog=/c/mingw490/prerequisites/x86_ 64-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='x86_64-win32-seh-rev1, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw490/x86_64-490-wi n32-seh-rt_v3-rev1/mingw64/opt/include -I/c/mingw490/prerequisites/x86_64-zlib-static/include -I/c/mingw490/pr erequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/c/mingw490/x86_64-490-win32-seh-rt_v3-re v1/mingw64/opt/include -I/c/mingw490/prerequisites/x86_64-zlib-static/include -I/c/mingw490/prerequisites/x86_ 64-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw490/x86_64-490-win32-seh-rt_v3-rev1/mingw64/ opt/lib -L/c/mingw490/prerequisites/x86_64-zlib-static/lib -L/c/mingw490/prerequisites/x86_64-w64-mingw32-stat ic/lib' Thread model: win32 gcc version 4.9.0 (x86_64-win32-seh-rev1, Built by MinGW-W64 project) |
|||
| msg221260 - (view) | Author: Pat Le Cat (Pat.Le.Cat) | Date: 2014-06-22 15:34 | |
Crash Error Window (pic) |
|||
| msg221536 - (view) | Author: Pat Le Cat (Pat.Le.Cat) | Date: 2014-06-25 08:36 | |
I zipped the whole Lib directory into "pyLib34.zip" (into same dir as EXE) and copied all the .pyd files from the DLLs dir into the same dir as the EXE. |
|||
| msg221779 - (view) | Author: Pat Le Cat (Pat.Le.Cat) | Date: 2014-06-28 10:22 | |
When working with the separately installed version of Python 3.4.1, which means by not using Py_SetPath() the embedding examples from your webpage work okay. So what's wrong with that function and why that allegedly missing module "encoding" that I cannot find anywhere but is obviously not missing when using the code without Py_SetPath()? Very confusing... |
|||
| msg401258 - (view) | Author: Irit Katriel (iritkatriel) * ![]() |
Date: 2021-09-07 13:06 | |
3.4 is long out of maintenance, please create a new issue if you are seeing this problem on a current version (>= 3.9). You are more likely to receive a response if you include a precise and complete description of the problem. For example, instead of saying "The example on your website", put a link to this example. I'm not sure what the "multiply.py" script you mention is. The less detective work a core dev needs to do just to understand the issue, the more likely they are to want to look into it. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:05 | admin | set | github: 66024 |
| 2021-09-07 13:06:03 | iritkatriel | set | status: open -> closed nosy:
+ iritkatriel resolution: out of date |
| 2014-06-28 10:22:46 | Pat.Le.Cat | set | messages: + msg221779 |
| 2014-06-26 22:42:42 | vstinner | set | nosy:
+ vstinner |
| 2014-06-25 08:36:54 | Pat.Le.Cat | set | messages: + msg221536 |
| 2014-06-22 15:34:19 | Pat.Le.Cat | set | files:
+ snakes_bug.jpg messages: + msg221260 |
| 2014-06-22 15:33:28 | Pat.Le.Cat | create | |
