get PythonManager working in Toon Boom Harmony v20

Question:

I am unable to get the PythonManager class working for Toon Boom Harmony v20 (20.0.4)

According to the documentation the PythonManager class should be available with the Harmony v20 installation.

When launching Harmony I get the following in the command line output:

Python not detected, python script will be disabled.

Harmony launch command line output

I have Python 2.7 and Python 3.6 installed on my machine with My environment variables containing:

C:Python39Scripts
C:Python39
C:Program Files (x86)Toon Boom AnimationToon Boom Harmony 20 Premiumwin64bin

I have uninstalled all previous Harmony versions on my machine to perform a clean install of Harmony v20.0.4

PythonManager is also unavailable when right clicking within the ScriptManager window ( where it displays all available classes/methods from that context.

Asked By: Chris Carter

||

Answers:

I solved this by updating Python to version 2.7.15

The Python version was 2.7.9 when I was experiencing the error.

I encountered this problem again After Upgrading to Harmony 22.0.1 which uses Python 3.9

To solve this, using Command Prompt I made sure that the system path was loading with:

import sys
sys.path.insert( 0, r"C:/Program Files (x86)/Toon Boom Animation/Toon Boom Harmony 22 Premium/win64/bin/python-packages" )

And then extended the DLL path with:

import os
os.add_dll_directory( "C:/Program Files (x86)/Toon Boom Animation/Toon Boom Harmony 22 Premium/win64/bin" )
os.add_dll_directory( "C:/Program Files (x86)/Toon Boom Animation/Toon Boom Harmony 22 Premium/win64/bin/python-packages/PySide6" )

and then checked the libraries were loading without error:

import PySide6 
from PySide6 import QtCore 
import ToonBoom
from ToonBoom import harmony

before launching a scene using the harmony class

pathToHarmonyProject = "C:/EXAMPLE_FOLDER/HARMONY_SCENE.xstage"
harmony.open_project(pathToHarmonyProject)  

(all of this code is within the same Command Prompt session)

Answered By: Chris Carter
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.