Fatal Python error: Py_Initialize: unable to load the file system codec ImportError: No module named 'encodings' after using py2exe - python-3.4

I was using py2exe and testing my new program when this came up on the exe console screen:
Fatal Python error: Py_Initialize: unable to load the file system codec
ImportError: No module named 'encodings'
what should I do?

I don't believe py2exe is compatible with 3.X. Try out PyInstaller instead.
Note: I am not affiliated with PyInstaller in any way, other than as a user.

Related

macdeployqt not deploying QtQuick modules

I'm using macdeployqt to deploy one QML application to Mac OS and when I finish, with all paths fine and try to execute it from .dmg generated package I can start application. Trying to execute it from term I get a QML error that says QtQuick.Window and other modules are not installed. Any clue about?
This is the command that I have tried:
$ macdeployqt MyApp.app -qmldir=/Users/jgd/dev/myapp -no-strip
I'm getting this error:
Log: Deploying QML imports
Log: Application QML file search path(s) is ("/Users/jngd/devel/MyApp/")
ERROR: qmlimportscanner output error. Expected json array, got:
ERROR: ""
QProcess: Destroyed while process ("/Users/jngd/devel/Qt/5.10.0/clang_64/bin/qmlimportscanner") is still running.

How to distribute compiled extensions?

I have just started to experiment with Zephir over the weekend, and had managed to compile and run a hello world extension on the mac terminal. I have AMPPS installed, and am trying to install this extension on AMPPS. Not sure if my steps are correct, but if I copied the .so file over, I get this error from AMPPS:
Warning: PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-7.1/lib/extensions/ext/utils.so' - dlopen(/Applications/AMPPS/php-7.1/lib/extensions/ext/utils.so, 9): no suitable image found. Did find: /Applications/AMPPS/php-7.1/lib/extensions/ext/utils.so: mach-o, but wrong architecture /Applications/AMPPS/php-7.1/lib/extensions/ext/utils.so: stat() failed with errno=3 in Unknown on line 07.1.2
What is the correct way to install the compiled extensions on hosted servers in future?
The ERROR was obvious : Unable to load dynamic library '/Applications/AMPPS/php-7.1/lib/extensions/ext/utils.so' . That may mean your .so lib was not found. Maybe you past your extension lib file into an incorrect path.
So you can try to type php -i | grep extension in your terminal.
And it will output your extension path like extension_dir => /usr/local/lib/php/extensions/no-debug-non-zts-20151012 => /usr/local/lib/php/extensions/no-debug-non-zts-20151012.
Check your extension exist or not in this direction.
BTW you can using command php -m to check how many extensions you have installed .

OpenCV Windows - The library is compiled without QT support in function displayOverlay

I'm getting the following error:
python run.py
OpenCV Error: The function/feature is not implemented (The library is compiled without QT support) in displayOverlay, file /build/opencv/src/opencv-3.4.0/modules/highgui/src/window.cpp, line 528
Traceback (most recent call last):
File "run.py", line 203, in <module>
change_img_index(0)
File "run.py", line 25, in change_img_index
"" + str(last_img_index), 1000)
cv2.error: /build/opencv/src/opencv-3.4.0/modules/highgui/src/window.cpp:528: error: (-213) The library is compiled without QT support in function displayOverlay
If I had installed via cmake I think I would only need to make sure the WITH_QT flag is set to WITH_QT=ON and recompile (as referenced here) but what if I installed using the pre-built libraries?
I came to this page because I had the same problem. I was having it trying to run python run.py for this Github project.
I actually found the solution to the problem on the project's page, in this issue's thread. Following the instructions provided by MattKleinsmith about installing opencv-python using:
pip install opencv-python
the script was able to run immediately.

install 2 qt builds on the same machine

I've been using static built Qt 5.0.2 built in this directory
D:\Soft\programming\qt-5.4.2.
Now I have installed the prebuilt qt-windows-opensource-5.0.2-mingw47_32-x86-offline to C:\Qt\Qt5.0.2
qmake location as shown in QtCreator configuration is C:\Qt\Qt5.0.2\5.0.2\mingw47_32\bin\qmake.exe
and compiler : C:\Qt\Qt5.0.2\Tools\MinGW\bin\gcc.exe
qmake location for the static version is
D:\Soft\programming\qt-5.4.2\qtbase\bin\qmake.exe and compiler
Microsoft Visual C++ Compiler 11.0 (x86)
Upon building a test program, I get several warnings of the form below.
C:\Users\Bill\Desktop\mkspecs\modules\qt_lib_sql.pri:8: error: WARNING: Include file D:/Soft/programming/qt-5.0.1/qtbase/mkspecs/modules-inst/qt_lib_sql.pri not found`
I used to ignore these errors in my static built qt. An example is
C:\Users\Bill\Documents\QtProjects\mkspecs\modules\qt_lib_sql.pri:8: error: WARNING: Include file D:/Soft/programming/qt-5.4.2/qtbase/mkspecs/modules-inst/qt_lib_sql.pri not found
Now, i get the warning and errors ;
:-1: error: error: unrecognized command line option '-wl,-enable-auto-import'
:-1: error: error: wl: No such file or directory
:-1: error: error: unrecognized command line option '-wl'
As a major concern, D:/Soft/programming/qt-5.0.1/ does not exists from the warnings of the prebuild in contrast to the existing D:/Soft/programming/qt-5.4.2 in the warning from the static build.
I'm guessing this new installation is reading configuration and qmake files from the static build directory.
If you are switching Qt versions you must do a 'nmake distclean' in your project folder (from a terminal or perhaps your IDE), then run qmake using from the version/path you want to build against. Otherwise old paths linger in your makefiles. A 'make clean' is not enough.

Qt apps break after build on MinGW

When I build Qt 4.8.2 it builds successfuly. But when I run any Qt pre-built apps (qtdemo.exe, designer.exe etc) it throws a procedure entry point error.
This is what it says:
I just can't get it to work!
I have build debug and release DLLs, without Phonon, Script, Qt3support, or webkit.
I opened the app in Dependency Walker and this is what it said in bold red text:
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with
different CPU types were found.
Warning: At least one delay-load
dependency module was not found. Warning: At least one module has an
unresolved import due to a missing export function in a delay-load
dependent module.
The problem occurs when there is another version of the QtCore4.dll in you system PATH. You can get around this by copying the newly compiled dll's into the same directory as the executable, so that it finds the correct version.
You could search your system for QtCore4.dll to see which program(s) installed the conflicting files.

Resources