HCAI
HCAI

Reputation: 2263

Python/Blender. ImportError: No module named 'ODS_Studio'

I have put a python script ODS_Studio.py into /home/$user/Downloads/script_addon_2-7x/addons/ however Blender cannot load the ODS module.

File "/home/$user/Downloads/script_addon_2-7x/addons/ODS_Studio.py", line 65, in <module>
    from ODS import register, unregister
zipimport.ZipImportError: can't find module 'ODS'

Why can't it find the module if it's in the right spot?

###########################################################
# Blender Modelling Environment for Architecture
# ODS_Studio.py


import bpy
import os
import sys

def load_depends(depends):
    for depend in depends:
        # sys.modules[depend].__addon_enabled__
        if not depend in bpy.context.user_preferences.addons:
            bpy.ops.wm.addon_enable(module=depend)

def import_lib(path):
    lib = path.split("/")[-1]
    mod = lib.replace("ODS_Studio","ODS")
    mod = mod.replace(".a","")
    try:
        M = __import__(mod)
    except ImportError:
        print("Unable to import module %s"%mod)
    return None

def load_libraries(paths):
    for path in paths:
        for sPath in bpy.utils.script_paths():
            absPath = '%s/%s'%(sPath, path)
            if not os.path.exists(absPath):
                print("%s not found"%path)
                continue
            if not absPath in sys.path:
                print("Found library: %s"%path)
                sys.path.insert(0, absPath)
                import_lib(path)
                break
    bpy.utils.refresh_script_paths()
    return None

load_libraries(['addons/ODS_Studio.a'])

from ODS import register, unregister

if __name__ == "__main__":
    register()

Upvotes: 0

Views: 631

Answers (1)

Mark Pitman
Mark Pitman

Reputation: 11

The ODS Studio modules for Blender currently only work with Blender version 2.63a. Updates for the latest version of Blender will come in the next few weeks.

Ensure that you have downloaded the latest modules from here.

Ensure that you extract all of the *.py and *.a files into your 2.63/scripts/addons folder and not into a subdirectory.

Restart Blender and you should be able to activate the modules without a problem on any platform.

Upvotes: 1

Related Questions