DrCyanide / cyanic-sd-krita

A Stable Diffusion plugin for Krita, compatible with A1111 and SD.Next
70 stars 4 forks source link

Krita 5.2Start error reporting #35

Closed liujvnes closed 6 months ago

liujvnes commented 6 months ago

Hello, I enabled the api in Stable Diffusion WebUI, and Krita reported an error when starting up. Please help me.

屏幕截图 2024-04-14 184151 TypeError Python 3.10.7: C:\软件\图形图像\Krita 5.2\bin\krita.exe Sun Apr 14 19:32:55 2024

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

C:\软件\图形图像\Krita 5.2\lib\krita-python-libs\krita\dockwidgetfactory.py in createDockWidget(self=) 14 super(DockWidgetFactory, self).init(_id, _dockPosition) 15 self.klass = _klass 16 17 def createDockWidget(self): 18 return self.klass() self = self.klass = <class 'cyanic.cyanic.CyanicDocker'>

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\cyanic.py in init(self=) 53 54 # Set the initial page 55 self.change_page() 56 57 # This was part of the template, might be relevant later self = self.change_page = <bound method CyanicDocker.change_page of >

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\cyanic.py in change_page(self=) 65 self.settings_controller.set('pages.last', page['name']) 66 self.settings_controller.save() 67 page['content']() 68 self.update() 69 page = {'content': <bound method CyanicDocker.show_txt2img of >, 'name': 'Txt2Img'}

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\cyanic.py in show_txt2img(self=) 76 77 def show_txt2img(self): 78 self.content_area.setWidget(Txt2ImgPage(self.settings_controller, self.api)) 79 80 def show_img2img(self): self = self.content_area = self.content_area.setWidget = global Txt2ImgPage = <class 'cyanic.pages.txt2img.Txt2ImgPage'> self.settings_controller = self.api =

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\pages\txt2img.py in init(self=, settings_controller=, api=) 15 self.setLayout(QVBoxLayout()) 16 17 self.model_widget = ModelsWidget(self.settings_controller, self.api) 18 self.layout().addWidget(self.model_widget) 19 self = self.model_widget undefined global ModelsWidget = <class 'cyanic.widgets.models.ModelsWidget'> self.settings_controller = self.api =

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\models.py in init(self=, settings_controller=, api=, ignore_hidden=False) 23 'sampling_steps': self.settings_controller.get('defaults.sampling_steps'), 24 } 25 self.init_variables() 26 27 self.draw_ui() self = self.init_variables = <bound method ModelsWidget.init_variables of >

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\models.py in init_variables(self=) 31 models, self.variables['model'] = self.api.get_models_and_default() 32 settings_model = self.settings_controller.get('defaults.model') 33 if len(settings_model) > 0 and settings_model in models: 34 self.variables['model'] = settings_model 35 builtinlen = settings_model = None models = ['anything-v5-PrtRE.safetensors [7f96a1a9ca]', 'cosxl_edit.safetensors', 'dreamshaper_8.safetensors [879db523c3]', 'dreamshaper_8LCM.safetensors', 'flat2DAnimerge_v45Sharp.safetensors', 'ghostmix_v20Bakedvae.safetensors', 'juggernautXL_v8Rundiffusion.safetensors', 'juggernautXL_v9Rdphoto2Lightning.safetensors', 'leosamsHelloworldSDXL_helloworldSDXL40.safetensors', 'majicmixRealistic_v7.safetensors', 'playgroundV25Fp16.safetensors [bcaa7dd678]', 'playgroundV25Fp32.safetensors', 'realisticStockPhoto_v20.safetensors', 'realisticVisionV51_v51VAE.safetensors', 'realisticVisionV60B1_v51VAE.safetensors', 'rmsdxlHybridTurboXL_scorpius.safetensors', 'sd_xl_base_1.0.safetensors', 'sd_xl_refiner_1.0.safetensors', 'SUPIR-v0Q.ckpt', 'TURBOV7.safetensors', ...] TypeError: object of type 'NoneType' has no len() cause = None class = <class 'TypeError'> context = None delattr = <method-wrapper 'delattr' of TypeError object> dict = {} dir = doc = 'Inappropriate argument type.' eq = <method-wrapper 'eq' of TypeError object> format = 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 = reduce = 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 = sizeof = str = <method-wrapper 'str' of TypeError object> subclasshook = __suppress_context = False traceback__ = args = ("object of type 'NoneType' has no len()",) with_traceback =

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

Traceback (most recent call last): File "C:\软件\图形图像\Krita 5.2\lib\krita-python-libs\krita\dockwidgetfactory.py", line 18, in createDockWidget return self.klass() File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\cyanic.py", line 55, in init self.change_page() File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\cyanic.py", line 67, in change_page page['content']() File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\cyanic.py", line 78, in show_txt2img self.content_area.setWidget(Txt2ImgPage(self.settings_controller, self.api)) File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\pages\txt2img.py", line 17, in init self.model_widget = ModelsWidget(self.settings_controller, self.api) File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\models.py", line 25, in init self.init_variables() File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\models.py", line 33, in init_variables if len(settings_model) > 0 and settings_model in models: TypeError: object of type 'NoneType' has no len()

DrCyanide commented 6 months ago

What's happening is that the plugin is trying to pull in your settings, using a combination of what you've used before and what's saved in your WebUI's settings. Since this is your first time using the plugin, it's trying to use the defaults I provide in cyanic/default_settings.json, but it's not finding them.

Can you check where you installed the plugin to see if cyanic/default_settings.json got deleted? If default_settings.json is not in the cyanic folder, then you can download just that file from here and see if that fixes it.

If it's still there, then it's possible that the way I try to find the cyanic directory isn't working on your computer. Krita doesn't provide a way to find the directory, so I have to ask Python "what directory is my program file in?", which has worked so far. I don't think the folder names being Chinese would mess up Python, but could I get the full path of where you installed cyanic-sd-krita just in case? I can try to replicate that on my computer and test it.

I'll try to change the code to not break if it can't find the default_settings.json in the meantime.

liujvnes commented 6 months ago

There is a default_settings.json file. I generated it once in Stable Diffusion WebUI. Now, no error is reported when opening the software. After connecting after entering the plug-in, an error will be reported when going to txt2img.

image

TypeError Python 3.10.7: C:\软件\图形图像\Krita 5.2\bin\krita.exe Sun Apr 14 21:36:44 2024

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

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\cyanic.py in change_page(self=) 65 self.settings_controller.set('pages.last', page['name']) 66 self.settings_controller.save() 67 page['content']() 68 self.update() 69 page = {'content': <bound method CyanicDocker.show_txt2img of >, 'name': 'Txt2Img'}

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\cyanic.py in show_txt2img(self=) 76 77 def show_txt2img(self): 78 self.content_area.setWidget(Txt2ImgPage(self.settings_controller, self.api)) 79 80 def show_img2img(self): self = self.content_area = self.content_area.setWidget = global Txt2ImgPage = <class 'cyanic.pages.txt2img.Txt2ImgPage'> self.settings_controller = self.api =

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\pages\txt2img.py in init(self=, settings_controller=, api=) 15 self.setLayout(QVBoxLayout()) 16 17 self.model_widget = ModelsWidget(self.settings_controller, self.api) 18 self.layout().addWidget(self.model_widget) 19 self = self.model_widget undefined global ModelsWidget = <class 'cyanic.widgets.models.ModelsWidget'> self.settings_controller = self.api =

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\models.py in init(self=, settings_controller=, api=, ignore_hidden=False) 23 'sampling_steps': self.settings_controller.get('defaults.sampling_steps'), 24 } 25 self.init_variables() 26 27 self.draw_ui() self = self.init_variables = <bound method ModelsWidget.init_variables of >

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\models.py in init_variables(self=) 31 models, self.variables['model'] = self.api.get_models_and_default() 32 settings_model = self.settings_controller.get('defaults.model') 33 if len(settings_model) > 0 and settings_model in models: 34 self.variables['model'] = settings_model 35 builtinlen = settings_model = None models = ['anything-v5-PrtRE.safetensors [7f96a1a9ca]', 'cosxl_edit.safetensors', 'dreamshaper_8.safetensors [879db523c3]', 'dreamshaper_8LCM.safetensors', 'flat2DAnimerge_v45Sharp.safetensors', 'ghostmix_v20Bakedvae.safetensors', 'juggernautXL_v8Rundiffusion.safetensors', 'juggernautXL_v9Rdphoto2Lightning.safetensors', 'leosamsHelloworldSDXL_helloworldSDXL40.safetensors', 'majicmixRealistic_v7.safetensors', 'playgroundV25Fp16.safetensors [bcaa7dd678]', 'playgroundV25Fp32.safetensors', 'realisticStockPhoto_v20.safetensors', 'realisticVisionV51_v51VAE.safetensors', 'realisticVisionV60B1_v51VAE.safetensors', 'rmsdxlHybridTurboXL_scorpius.safetensors', 'sd_xl_base_1.0.safetensors', 'sd_xl_refiner_1.0.safetensors', 'SUPIR-v0Q.ckpt', 'TURBOV7.safetensors', ...] TypeError: object of type 'NoneType' has no len() cause = None class = <class 'TypeError'> context = None delattr = <method-wrapper 'delattr' of TypeError object> dict = {} dir = doc = 'Inappropriate argument type.' eq = <method-wrapper 'eq' of TypeError object> format = 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 = reduce = 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 = sizeof = str = <method-wrapper 'str' of TypeError object> subclasshook = __suppress_context = False traceback__ = args = ("object of type 'NoneType' has no len()",) with_traceback =

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

Traceback (most recent call last): File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\cyanic.py", line 67, in change_page page['content']() File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\cyanic.py", line 78, in show_txt2img self.content_area.setWidget(Txt2ImgPage(self.settings_controller, self.api)) File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\pages\txt2img.py", line 17, in init self.model_widget = ModelsWidget(self.settings_controller, self.api) File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\models.py", line 25, in init self.init_variables() File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\models.py", line 33, in init_variables if len(settings_model) > 0 and settings_model in models: TypeError: object of type 'NoneType' has no len()

DrCyanide commented 6 months ago

Just double checking, you do have a model or two installed for WebUI, right?

I pushed a new version of the models selector code just now, and it should fix these errors, but I'm guessing there's something else that's the root of the problem and this is just where the code is crashing because of it. Still, worth pulling down a new copy and seeing what the next error is.

liujvnes commented 6 months ago

仔细检查一下,您确实为WebUI安装了一两个模型,对吧?

我刚才推送了模型选择器代码的新版本,它应该可以修复_这些_错误,但我猜还有其他东西是问题的根源,而这正是代码因此而崩溃的地方。尽管如此,还是值得拉下一个新的副本,看看下一个错误是什么。

Thank you very much. I can connect now. txt2img reports an error and img2img runs normally. 屏幕截图 2024-04-15 000822 AttributeError Python 3.10.7: C:\软件\图形图像\Krita 5.2\bin\krita.exe Mon Apr 15 00:07:39 2024

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

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\generate.py in handle_generate_btn_click(self=) 49 self.cancel() 50 else: 51 self.generate() 52 self.update() 53 self = self.generate = <bound method GenerateWidget.generate of >

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\generate.py in generate(self=) 123 if w_key in data: 124 # data[w_key] has a conflict. Go through w_value.items() and add each one 125 for nested_key, nested_value in w_value.items(): 126 data[w_key][nested_key] = nested_value 127 else: nested_key undefined nested_value undefined w_value = 512 w_value.items undefined AttributeError: 'int' object has no attribute 'items' cause = None class = <class 'AttributeError'> context = None delattr = <method-wrapper 'delattr' of AttributeError object> dict = {} dir = doc = 'Attribute not found.' eq = <method-wrapper 'eq' of AttributeError object> format = ge = <method-wrapper 'ge' of AttributeError object> getattribute = <method-wrapper 'getattribute' of AttributeError object> gt = <method-wrapper 'gt' of AttributeError object> hash = <method-wrapper 'hash' of AttributeError object> init = <method-wrapper 'init' of AttributeError object> init_subclass = <built-in method init_subclass of type object> le = <method-wrapper 'le' of AttributeError object> lt = <method-wrapper 'lt' of AttributeError object> ne = <method-wrapper 'ne' of AttributeError object> new = reduce = reduce_ex = <built-in method reduce_ex of AttributeError object> repr = <method-wrapper 'repr' of AttributeError object> setattr = <method-wrapper 'setattr' of AttributeError object> setstate = sizeof = str = <method-wrapper 'str' of AttributeError object> subclasshook = __suppress_context = False traceback__ = args = ("'int' object has no attribute 'items'",) name = 'items' obj = 512 with_traceback =

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

Traceback (most recent call last): File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\generate.py", line 51, in handle_generate_btn_click self.generate() File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\generate.py", line 125, in generate for nested_key, nested_value in w_value.items(): AttributeError: 'int' object has no attribute 'items'

image

DrCyanide commented 6 months ago

OK, I didn't test that last change enough. Try pulling it again and see if it works now.

liujvnes commented 6 months ago

OK, I didn't test that last change enough. Try pulling it again and see if it works now.

Hello, I can use it after uninstalling it, but ControlNet still reports an error. Please check the reason again. Thank you very much.

KeyError Python 3.10.7: C:\软件\图形图像\Krita 5.2\bin\krita.exe Mon Apr 15 12:13:09 2024

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

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\extension_widgets\controlnet.py in () 138 self.preprocessor_select.setMaxVisibleItems(5) # Suppose to limit the number of visible options 139 # self.preprocessor_select.currentIndexChanged.connect(lambda: self.set_preprocessor_settings(self.preprocessor_select.currentText())) # ... This steps through EVERY index in between 140 self.preprocessor_select.currentTextChanged.connect(lambda: self.set_preprocessor_settings(self.preprocessor_select.currentText())) 141 control_type_row.layout().addRow('Preprocessor', self.preprocessor_select) 142 self = self.preprocessor_select = self.preprocessor_select.currentTextChanged = self.preprocessor_select.currentTextChanged.connect = self.set_preprocessor_settings = > self.preprocessor_select.currentText =

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\extension_widgets\controlnet.py in set_preprocessor_settings(self=, preprocessor_name='softedge_pidinet') 398 self.preprocessor = preprocessor_name 399 400 details = self.cnapi.module_details[preprocessor_name] 401 self.model_select.setHidden(details['model_free']) 402 details undefined self = self.cnapi = self.cnapi.module_details = {} preprocessor_name = 'softedge_pidinet' KeyError: 'softedge_pidinet' cause = None class = <class 'KeyError'> context = None delattr = <method-wrapper 'delattr' of KeyError object> dict = {} dir = doc = 'Mapping key not found.' eq = <method-wrapper 'eq' of KeyError object> format = ge = <method-wrapper 'ge' of KeyError object> getattribute = <method-wrapper 'getattribute' of KeyError object> gt = <method-wrapper 'gt' of KeyError object> hash = <method-wrapper 'hash' of KeyError object> init = <method-wrapper 'init' of KeyError object> init_subclass = <built-in method init_subclass of type object> le = <method-wrapper 'le' of KeyError object> lt = <method-wrapper 'lt' of KeyError object> ne = <method-wrapper 'ne' of KeyError object> new = reduce = reduce_ex = <built-in method reduce_ex of KeyError object> repr = <method-wrapper 'repr' of KeyError object> setattr = <method-wrapper 'setattr' of KeyError object> setstate = sizeof = str = <method-wrapper 'str' of KeyError object> subclasshook = __suppress_context = False traceback__ = args = ('softedge_pidinet',) with_traceback =

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

Traceback (most recent call last): File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\extension_widgets\controlnet.py", line 140, in self.preprocessor_select.currentTextChanged.connect(lambda: self.set_preprocessor_settings(self.preprocessor_select.currentText())) File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\extension_widgets\controlnet.py", line 400, in set_preprocessor_settings details = self.cnapi.module_details[preprocessor_name] KeyError: 'softedge_pidinet'

DrCyanide commented 6 months ago

I believe it's a Forge specific bug, where their built-in version of ControlNet has a different API response than the A1111 and SD.Next versions. I've filed a bug report with them about it here. The Forge version omits information needed to create the preprocessor sliders, which can be useful for fine tuning the results.

I pushed a "fix" that skips the preprocessor sliders, avoiding the error. Thanks for your patience with me fixing all these bugs.

liujvnes commented 6 months ago

I believe it's a Forge specific bug, where their built-in version of ControlNet has a different API response than the A1111 and SD.Next versions. I've filed a bug report with them about it here. The Forge version omits information needed to create the preprocessor sliders, which can be useful for fine tuning the results.

I pushed a "fix" that skips the preprocessor sliders, avoiding the error. Thanks for your patience with me fixing all these bugs.

I understand, I don’t know English, so I use the software to translate and use various functions, mainly photo modification functions. Of course, it would be better if you can develop simplified Chinese. Thank you again for your selfless dedication!

liujvnes commented 6 months ago

Hello! There is a bug in Remove Background image

AttributeError Python 3.10.7: C:\软件\图形图像\Krita 5.2\bin\krita.exe Mon Apr 15 15:17:01 2024

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

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\pages\rembg.py in () 79 # Remove Background/Generate button 80 generate_btn = QPushButton('Remove Background') 81 generate_btn.clicked.connect(lambda: self.run_rembg()) 82 self.layout().addWidget(generate_btn) 83 generate_btn undefined self = self.run_rembg = <bound method RemBGPage.run_rembg of >

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\pages\rembg.py in run_rembg(self=) 156 as_mask = self.settings_controller.get('rembg.results_as_mask') 157 if (as_mask and not apply_mask) or not as_mask: 158 self.kc.results_to_layers(results, self.size_dict['x'], self.size_dict['y'], self.size_dict['w'], self.size_dict['h']) 159 else: 160 self.kc.result_to_transparency_mask(results, self.size_dict['x'], self.size_dict['y'], self.size_dict['w'], self.size_dict['h']) self = self.kc = self.kc.result_to_transparency_mask = <bound method KritaController.result_to_transpar...> results = {'image': 'iVBORw0KGgoAAAANSUhEUgAABDgAAAZUCAAAAAAh0u1bAADn...DMAzDMAzDMAzDMMyn8f8DHQ6l5OlA5C4AAAAASUVORK5CYII='} self.size_dict = {'h': 1620, 'w': 1080, 'x': 0, 'y': 0}

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\krita_controller.py in result_to_transparency_mask(self=, results={'image': 'iVBORw0KGgoAAAANSUhEUgAABDgAAAZUCAAAAAAh0u1bAADn...DMAzDMAzDMAzDMMyn8f8DHQ6l5OlA5C4AAAAASUVORK5CYII='}, x=0, y=0, w=1080, h=1620) 285 def result_to_transparency_mask(self, results, x=0, y=0, w=-1, h=-1): 286 delay = 500 #ms 287 old_active = self.doc.activeNode() 288 is_group = old_active.type() == 'grouplayer' 289 parent_node = old_active.parentNode() old_active undefined self = self.doc = None self.doc.activeNode undefined AttributeError: 'NoneType' object has no attribute 'activeNode' cause = None class = <class 'AttributeError'> context = None delattr = <method-wrapper 'delattr' of AttributeError object> dict = {} dir = doc = 'Attribute not found.' eq = <method-wrapper 'eq' of AttributeError object> format = ge = <method-wrapper 'ge' of AttributeError object> getattribute = <method-wrapper 'getattribute' of AttributeError object> gt = <method-wrapper 'gt' of AttributeError object> hash = <method-wrapper 'hash' of AttributeError object> init = <method-wrapper 'init' of AttributeError object> init_subclass = <built-in method init_subclass of type object> le = <method-wrapper 'le' of AttributeError object> lt = <method-wrapper 'lt' of AttributeError object> ne = <method-wrapper 'ne' of AttributeError object> new = reduce = reduce_ex = <built-in method reduce_ex of AttributeError object> repr = <method-wrapper 'repr' of AttributeError object> setattr = <method-wrapper 'setattr' of AttributeError object> setstate = sizeof = str = <method-wrapper 'str' of AttributeError object> subclasshook = __suppress_context = False traceback__ = args = ("'NoneType' object has no attribute 'activeNode'",) name = 'activeNode' obj = None with_traceback =

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

Traceback (most recent call last): File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\pages\rembg.py", line 81, in generate_btn.clicked.connect(lambda: self.run_rembg()) File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\pages\rembg.py", line 160, in run_rembg self.kc.result_to_transparency_mask(results, self.size_dict['x'], self.size_dict['y'], self.size_dict['w'], self.size_dict['h']) File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\krita_controller.py", line 287, in result_to_transparency_mask old_active = self.doc.activeNode() AttributeError: 'NoneType' object has no attribute 'activeNode'

liujvnes commented 6 months ago

RuntimeError Python 3.10.7: C:\软件\图形图像\Krita 5.2\bin\krita.exe Mon Apr 15 15:34:54 2024

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

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\generate.py in () 143 self.kc.run_as_thread(lambda: self.threadable_run(data), lambda: self.threadable_return(x, y, w, h, processing_instructions)) 144 self.progress_timer = QTimer() 145 self.progress_timer.timeout.connect(lambda: self.progress_check(x, y, w, h, processing_instructions)) 146 # Set the refresh rate 147 if self.settings_controller.has_key('previews.refresh_seconds'): self = self.progress_timer = self.progress_timer.timeout = self.progress_timer.timeout.connect = self.progress_check = <bound method GenerateWidget.progress_check of > x = 0 y = 0 w = 1080 h = 1620 processing_instructions = {}

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\generate.py in progress_check(self=, x=0, y=0, w=1080, h=1620, processing_instructions={}) 182 self.abort = False 183 self.finished = False 184 self.progress_bar.setValue(1) 185 self.kc.delete_preview_layer() 186 self.progress_timer.stop() self = self.progress_bar = self.progress_bar.setValue = RuntimeError: wrapped C/C++ object of type QProgressBar has been deleted cause = None class = <class 'RuntimeError'> context = RuntimeError('wrapped C/C++ object of type QProgressBar has been deleted') delattr = <method-wrapper 'delattr' of RuntimeError object> dict = {} dir = doc = 'Unspecified run-time error.' eq = <method-wrapper 'eq' of RuntimeError object> format = ge = <method-wrapper 'ge' of RuntimeError object> getattribute = <method-wrapper 'getattribute' of RuntimeError object> gt = <method-wrapper 'gt' of RuntimeError object> hash = <method-wrapper 'hash' of RuntimeError object> init = <method-wrapper 'init' of RuntimeError object> init_subclass = <built-in method init_subclass of type object> le = <method-wrapper 'le' of RuntimeError object> lt = <method-wrapper 'lt' of RuntimeError object> ne = <method-wrapper 'ne' of RuntimeError object> new = reduce = reduce_ex = <built-in method reduce_ex of RuntimeError object> repr = <method-wrapper 'repr' of RuntimeError object> setattr = <method-wrapper 'setattr' of RuntimeError object> setstate = sizeof = str = <method-wrapper 'str' of RuntimeError object> subclasshook = __suppress_context = False traceback__ = args = ('wrapped C/C++ object of type QProgressBar has been deleted',) with_traceback =

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

Traceback (most recent call last): File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\generate.py", line 172, in progress_check self.progress_bar.setValue(int(results['progress'] * 100)) RuntimeError: wrapped C/C++ object of type QProgressBar has been deleted

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\generate.py", line 145, in self.progress_timer.timeout.connect(lambda: self.progress_check(x, y, w, h, processing_instructions)) File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\generate.py", line 184, in progress_check self.progress_bar.setValue(1) RuntimeError: wrapped C/C++ object of type QProgressBar has been deleted

liujvnes commented 6 months ago

Hello! When switching the interface during txt2img running, the program will report an error and the background process continues. If you switch back to txt2img again, the previous settings and progress bar will disappear, and the running speed has doubled after this update.

image

RuntimeError Python 3.10.7: C:\软件\图形图像\krita 5.3\bin\krita.exe Mon Apr 15 17:48:01 2024

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

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\generate.py in () 143 self.kc.run_as_thread(lambda: self.threadable_run(data), lambda: self.threadable_return(x, y, w, h, processing_instructions)) 144 self.progress_timer = QTimer() 145 self.progress_timer.timeout.connect(lambda: self.progress_check(x, y, w, h, processing_instructions)) 146 # Set the refresh rate 147 if self.settings_controller.has_key('previews.refresh_seconds'): self = self.progress_timer = self.progress_timer.timeout = self.progress_timer.timeout.connect = self.progress_check = <bound method GenerateWidget.progress_check of > x = 0 y = 0 w = 1080 h = 1620 processing_instructions = {}

C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\generate.py in progress_check(self=, x=0, y=0, w=1080, h=1620, processing_instructions={}) 182 self.abort = False 183 self.finished = False 184 self.progress_bar.setValue(1) 185 self.kc.delete_preview_layer() 186 self.progress_timer.stop() self = self.progress_bar = self.progress_bar.setValue = RuntimeError: wrapped C/C++ object of type QProgressBar has been deleted cause = None class = <class 'RuntimeError'> context = RuntimeError('wrapped C/C++ object of type QProgressBar has been deleted') delattr = <method-wrapper 'delattr' of RuntimeError object> dict = {} dir = doc = 'Unspecified run-time error.' eq = <method-wrapper 'eq' of RuntimeError object> format = ge = <method-wrapper 'ge' of RuntimeError object> getattribute = <method-wrapper 'getattribute' of RuntimeError object> gt = <method-wrapper 'gt' of RuntimeError object> hash = <method-wrapper 'hash' of RuntimeError object> init = <method-wrapper 'init' of RuntimeError object> init_subclass = <built-in method init_subclass of type object> le = <method-wrapper 'le' of RuntimeError object> lt = <method-wrapper 'lt' of RuntimeError object> ne = <method-wrapper 'ne' of RuntimeError object> new = reduce = reduce_ex = <built-in method reduce_ex of RuntimeError object> repr = <method-wrapper 'repr' of RuntimeError object> setattr = <method-wrapper 'setattr' of RuntimeError object> setstate = sizeof = str = <method-wrapper 'str' of RuntimeError object> subclasshook = __suppress_context = False traceback__ = args = ('wrapped C/C++ object of type QProgressBar has been deleted',) with_traceback =

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

Traceback (most recent call last): File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\generate.py", line 172, in progress_check self.progress_bar.setValue(int(results['progress'] * 100)) RuntimeError: wrapped C/C++ object of type QProgressBar has been deleted

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\generate.py", line 145, in self.progress_timer.timeout.connect(lambda: self.progress_check(x, y, w, h, processing_instructions)) File "C:\Users\liujv\AppData\Roaming\krita\pykrita\cyanic\widgets\generate.py", line 184, in progress_check self.progress_bar.setValue(1) RuntimeError: wrapped C/C++ object of type QProgressBar has been deleted

DrCyanide commented 6 months ago
  1. I don't know how to make a language translation option for the plugin. There are other features and bug fixes that need to happen for all users first, so translations will probably be a lower priority. I know that sucks for you, but you've also seen enough crashes to understand why I need to focus on the bugs.
  2. What were you doing before you removed background? That error is saying that it couldn't find the Krita document.
  3. Switching from Txt2Img to Img2Img (or any other mode) deletes the old page, which is why the settings disappear. I might have thought of a fix for the progress bar error message itself though, I'll try to get that tested soon.

I'm going to mark this bug report as closed, because we're a bit past start up errors now (and you made the other ticket to report more issues).

DrCyanide commented 6 months ago

Switching tabs now shouldn't crash the image generation. It doesn't let you interrupt it or see the progress if you go back.