This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Extension script to run an external tool

Tags: None
(comma "," separated)
tmartin
Registered Member
Posts
1
Karma
0
I'm trying to write simple extension to run the external tool ComicCreator. I have tried this as my stab, which doesn't work:

Code: Select all
from krita import *
from os import system

class ComicCreatorExtension(Extension):

    def __init__(self, parent):
        #This is initialising the parent, always  important when subclassing.
        super().__init__(parent)

    def setup(self):
        pass

    def createActions(self, window):
        action = window.createAction("comicAction", "Comic Creator", "tools/scripts")
        action.triggered.connect(self.comicCreation)

    def comicCreation(arg1, arg2):
        myCmd = 'ComicCreator'
        os.system(myCmd)
   
       
# And add the extension to Krita's list of extensions:
Krita.instance().addExtension(ComicCreatorExtension(Krita.instance()))


Running this by clicking on the tools/script entry seems to achieve nothing. Running the following in scripter:

Code: Select all
from os import system

myApp = 'ComicCreator'
os.system(myApp)


fails with the following:
Code: Select all
======================================

**********************
AttributeError: 'NoneType' object has no attribute 'loader'

In file: <frozen importlib._bootstrap>
In function: module_from_spec at line: 580. Line with error:

**********************


I am Lego coding, and hope somebody with a better understanding of Krita scripting can see my error.

TIA.

Tony


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]