Помилки щодо Python – Python Errors#

Передкомпільовані Бібліотеки – Precompiled Libraries#

While not common practice, Python add-ons can be distributed with their own precompiled libraries. Unlike regular Python scripts, these are not portable between different platforms.

Можливо, що певна бібліотека є несумісною з вашою інсталяцією Blender’а (намагається завантажити бібліотеку, побудовану для іншої версії Python, або завантажити 32-бітну бібліотеку на 64-бітній системі).

Якщо теки додатків містять файли .pyd або .so, то перевірте, чи цей дистрибутив є сумісним із вашою операційною системою.

Специфічно для Платформи – Platform Specific#

Windows#

Mixed Python Libraries (DLLs)#

Якщо Python піднімає помилки або ви маєте додаток, що просто падає, коли вмикається, з помилкою: «… не є дійсним застосунком Win32» – ... is not a valid Win32 application..

../_images/troubleshooting_python_traceback.png

Відслідження – traceback Python.#

This may be caused by some inconsistency in the Python libraries. While Blender comes with its own bundled Python interpreter, duplicate, incompatible libraries can cause problems.

Для виявлення, яка бібліотека Python спричинила проблему, перевірте повідомлення про помилку.

This is normally reported somewhere around the bottom line of the traceback. With the error above you see the problem is caused while trying to import _socket. This corresponds to either a file named _socket.py or _socket.pyd.

To help troubleshoot this problem, the following script can be pasted into the Text editor and run to check for duplicate libraries in your search path. (The output will show in Command Line Window.)

import os
import sys

# Change this based on the library you wish to test
test_lib = "_socket.pyd"

def GetSystemDirectory():
    from ctypes import windll, create_string_buffer, sizeof
    GetSystemDirectory = windll.kernel32.GetSystemDirectoryA
    buffer = create_string_buffer(260)
    GetSystemDirectory(buffer, sizeof(buffer))
    return os.fsdecode(buffer.value)

def library_search_paths():
    return (
        # Windows search paths
        os.path.dirname(sys.argv[0]),
        os.getcwd(),
        GetSystemDirectory(),
        os.environ["WINDIR"],  # GetWindowsDirectory
        *os.environ["PATH"].split(";"),

        # regular Python search paths
        *sys.path,
        )

def check_library_duplicate(libname):
    paths = [p for p in library_search_paths()
             if os.path.exists(os.path.join(p, libname))]

    print("Library %r found in %d locations:" % (libname, len(paths)))
    for p in paths:
        print("- %r" % p)

check_library_duplicate(test_lib)