ndee85/coa_tools

Krita export error: TypeError

frdbr opened this issue · 0 comments

frdbr commented

It doesn't work anymore with Krita 5.1.

TypeError
Python 3.10.6: /usr/bin/python3
Wed Aug 31 22:57:53 2022

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /home/farid/.local/share/krita/pykrita/coa_tools_exporter/coa_tools_docker.py in export(self=<coa_tools_exporter.coa_tools_docker.COAToolsDocker object>)
  151 
  152         if self.exportPath.text() != "" and self.exportName.text() != "":
  153             self.exportSelectedNodes(self.exportPath.text(), self.exportName.text())
  154             QtWidgets.QMessageBox.about(self, "Info", "Exported finished.")
  155         else:
self = <coa_tools_exporter.coa_tools_docker.COAToolsDocker object>
self.exportSelectedNodes = <bound method COAToolsDocker.exportSelectedNodes...exporter.coa_tools_docker.COAToolsDocker object>>
self.exportPath = <PyQt5.QtWidgets.QLineEdit object>
self.exportPath.text = <built-in method text of QLineEdit object>
self.exportName = <PyQt5.QtWidgets.QLineEdit object>
self.exportName.text = <built-in method text of QLineEdit object>

 /home/farid/.local/share/krita/pykrita/coa_tools_exporter/coa_tools_docker.py in exportSelectedNodes(self=<coa_tools_exporter.coa_tools_docker.COAToolsDocker object>, exportPath='/home/farid/Gunga/Festival de Cinema de Taguatinga/2022/bird', coaObjectName='bird')
  186             jsonData["nodes"].append(newCoaNode)
  187 
  188             self.exportNode(node, path)
  189 
  190         ### write json data
self = <coa_tools_exporter.coa_tools_docker.COAToolsDocker object>
self.exportNode = <bound method COAToolsDocker.exportNode of <coa_...exporter.coa_tools_docker.COAToolsDocker object>>
node = <PyKrita.krita.Node object>
path = '/home/farid/Gunga/Festival de Cinema de Taguatinga/2022/bird/sprites/bird.png'

 /home/farid/.local/share/krita/pykrita/coa_tools_exporter/coa_tools_docker.py in exportNode(self=<coa_tools_exporter.coa_tools_docker.COAToolsDocker object>, node=<PyKrita.krita.Node object>, path='/home/farid/Gunga/Festival de Cinema de Taguatinga/2022/bird/sprites/bird.png')
  206         ### paste pixel data into layer of new document
  207         newNode = newDoc.rootNode().childNodes()[0]
  208         newNode.setPixelData(pixelData, 0.0, 0.0, node.bounds().width(), node.bounds().height())
  209         newNode.setOpacity(255)
  210         newDoc.refreshProjection()
newNode = <PyKrita.krita.Node object>
newNode.setPixelData = <built-in method setPixelData of Node object>
pixelData = PyQt5.QtCore.QByteArray(b'\x00\x00\x00\x00\x00\x...x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
node = <PyKrita.krita.Node object>
node.bounds = <built-in method bounds of Node object>
).width undefined
).height undefined
TypeError: setPixelData(self, Union[QByteArray, bytes, bytearray], int, int, int, int): argument 2 has unexpected type 'float'
    __cause__ = None
    __class__ = <class 'TypeError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of TypeError object>
    __dict__ = {}
    __dir__ = <built-in method __dir__ of TypeError object>
    __doc__ = 'Inappropriate argument type.'
    __eq__ = <method-wrapper '__eq__' of TypeError object>
    __format__ = <built-in method __format__ of TypeError object>
    __ge__ = <method-wrapper '__ge__' of TypeError object>
    __getattribute__ = <method-wrapper '__getattribute__' of TypeError object>
    __gt__ = <method-wrapper '__gt__' of TypeError object>
    __hash__ = <method-wrapper '__hash__' of TypeError object>
    __init__ = <method-wrapper '__init__' of TypeError object>
    __init_subclass__ = <built-in method __init_subclass__ of type object>
    __le__ = <method-wrapper '__le__' of TypeError object>
    __lt__ = <method-wrapper '__lt__' of TypeError object>
    __ne__ = <method-wrapper '__ne__' of TypeError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of TypeError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of TypeError object>
    __repr__ = <method-wrapper '__repr__' of TypeError object>
    __setattr__ = <method-wrapper '__setattr__' of TypeError object>
    __setstate__ = <built-in method __setstate__ of TypeError object>
    __sizeof__ = <built-in method __sizeof__ of TypeError object>
    __str__ = <method-wrapper '__str__' of TypeError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ("setPixelData(self, Union[QByteArray, bytes, byte...int, int): argument 2 has unexpected type 'float'",)
    with_traceback = <built-in method with_traceback of TypeError object>

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "/home/farid/.local/share/krita/pykrita/coa_tools_exporter/coa_tools_docker.py", line 153, in export
    self.exportSelectedNodes(self.exportPath.text(), self.exportName.text())
  File "/home/farid/.local/share/krita/pykrita/coa_tools_exporter/coa_tools_docker.py", line 188, in exportSelectedNodes
    self.exportNode(node, path)
  File "/home/farid/.local/share/krita/pykrita/coa_tools_exporter/coa_tools_docker.py", line 208, in exportNode
    newNode.setPixelData(pixelData, 0.0, 0.0, node.bounds().width(), node.bounds().height())
TypeError: setPixelData(self, Union[QByteArray, bytes, bytearray], int, int, int, int): argument 2 has unexpected type 'float'