This is so super useful for making grids for comic pages!
Unfortunately it worked the first time, but now does not want to run anymore…
It’s something with the default preset.
In the traceback it says:
args = ("could not convert string to float: '2,00'",)
Weirdly it still does that even if I delete the script and reinstall it. Where does it save the defaults?
Here’s the complete output:
ValueError
Python 3.10.7: /Applications/krita.app/Contents/MacOS/krita
Wed Jan 15 21:39:17 2025
A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.
~/Library/Application Support/krita/pykrita/tile_grid/tile_grid.py in add_tile_grid(self=<tile_grid.tile_grid.TileGridExtension object>)
479 doc_ppi = doc.resolution()
480
481 dialog = TileGridDialog(doc_size_x, doc_size_y, doc_ppi)
482 if not dialog.exec_() == QDialog.Accepted:
483 return
dialog undefined
global TileGridDialog = <class 'tile_grid.tile_grid.TileGridDialog'>
doc_size_x = 2480
doc_size_y = 3508
doc_ppi = 300
~/Library/Application Support/krita/pykrita/tile_grid/tile_grid.py in __init__(self=<tile_grid.tile_grid.TileGridDialog object>, doc_size_x=2480, doc_size_y=3508, doc_ppi=300)
234
235 # Load the last used preset on initialization
236 self.load_last_preset()
237
238 # Connect the comboboxes to on_combobox_index_changed with an indirection to allow more parameters
self = <tile_grid.tile_grid.TileGridDialog object>
self.load_last_preset = <bound method TileGridDialog.load_last_preset of <tile_grid.tile_grid.TileGridDialog object>>
~/Library/Application Support/krita/pykrita/tile_grid/tile_grid.py in load_last_preset(self=<tile_grid.tile_grid.TileGridDialog object>)
401 with open(last_preset_path, 'r') as file:
402 preset = json.load(file)
403 self.apply_preset(preset)
404 except FileNotFoundError:
405 self.default_preset()
self = <tile_grid.tile_grid.TileGridDialog object>
self.apply_preset = <bound method TileGridDialog.apply_preset of <tile_grid.tile_grid.TileGridDialog object>>
preset = {'clear_guides': True, 'gutter_x': '0,50', 'gutter_x_unit': 'Centimeter (cm)', 'gutter_y': '0,40', 'gutter_y_unit': 'Centimeter (cm)', 'lock_guides': True, 'margin_b': '3,00', 'margin_b_unit': 'Centimeter (cm)', 'margin_l': '2,00', 'margin_l_unit': 'Centimeter (cm)', ...}
~/Library/Application Support/krita/pykrita/tile_grid/tile_grid.py in apply_preset(self=<tile_grid.tile_grid.TileGridDialog object>, preset={'clear_guides': True, 'gutter_x': '0,50', 'gutter_x_unit': 'Centimeter (cm)', 'gutter_y': '0,40', 'gutter_y_unit': 'Centimeter (cm)', 'lock_guides': True, 'margin_b': '3,00', 'margin_b_unit': 'Centimeter (cm)', 'margin_l': '2,00', 'margin_l_unit': 'Centimeter (cm)', ...})
377
378 # Set the values of the spinboxes and checkboxes
379 self.margin_l.setValue(float(preset.get("margin_l", self.DEFAULT_MARGIN_L_PC)))
380 self.margin_r.setValue(float(preset.get("margin_r", self.DEFAULT_MARGIN_R_PC)))
381 self.margin_t.setValue(float(preset.get("margin_t", self.DEFAULT_MARGIN_T_PC)))
self = <tile_grid.tile_grid.TileGridDialog object>
self.margin_l = <PyQt5.QtWidgets.QDoubleSpinBox object>
self.margin_l.setValue = <built-in method setValue of QDoubleSpinBox object>
builtinfloat = <class 'float'>
preset = {'clear_guides': True, 'gutter_x': '0,50', 'gutter_x_unit': 'Centimeter (cm)', 'gutter_y': '0,40', 'gutter_y_unit': 'Centimeter (cm)', 'lock_guides': True, 'margin_b': '3,00', 'margin_b_unit': 'Centimeter (cm)', 'margin_l': '2,00', 'margin_l_unit': 'Centimeter (cm)', ...}
preset.get = <built-in method get of dict object>
self.DEFAULT_MARGIN_L_PC = 10.0
ValueError: could not convert string to float: '2,00'
__cause__ = None
__class__ = <class 'ValueError'>
__context__ = None
__delattr__ = <method-wrapper '__delattr__' of ValueError object>
__dict__ = {}
__dir__ = <built-in method __dir__ of ValueError object>
__doc__ = 'Inappropriate argument value (of correct type).'
__eq__ = <method-wrapper '__eq__' of ValueError object>
__format__ = <built-in method __format__ of ValueError object>
__ge__ = <method-wrapper '__ge__' of ValueError object>
__getattribute__ = <method-wrapper '__getattribute__' of ValueError object>
__gt__ = <method-wrapper '__gt__' of ValueError object>
__hash__ = <method-wrapper '__hash__' of ValueError object>
__init__ = <method-wrapper '__init__' of ValueError object>
__init_subclass__ = <built-in method __init_subclass__ of type object>
__le__ = <method-wrapper '__le__' of ValueError object>
__lt__ = <method-wrapper '__lt__' of ValueError object>
__ne__ = <method-wrapper '__ne__' of ValueError object>
__new__ = <built-in method __new__ of type object>
__reduce__ = <built-in method __reduce__ of ValueError object>
__reduce_ex__ = <built-in method __reduce_ex__ of ValueError object>
__repr__ = <method-wrapper '__repr__' of ValueError object>
__setattr__ = <method-wrapper '__setattr__' of ValueError object>
__setstate__ = <built-in method __setstate__ of ValueError object>
__sizeof__ = <built-in method __sizeof__ of ValueError object>
__str__ = <method-wrapper '__str__' of ValueError object>
__subclasshook__ = <built-in method __subclasshook__ of type object>
__suppress_context__ = False
__traceback__ = <traceback object>
args = ("could not convert string to float: '2,00'",)
with_traceback = <built-in method with_traceback of ValueError object>
The above is a description of an error in a Python program. Here is
the original traceback:
Traceback (most recent call last):
File "~/Library/Application Support/krita/pykrita/tile_grid/tile_grid.py", line 481, in add_tile_grid
dialog = TileGridDialog(doc_size_x, doc_size_y, doc_ppi)
File "~/Library/Application Support/krita/pykrita/tile_grid/tile_grid.py", line 236, in __init__
self.load_last_preset()
File "~/Library/Application Support/krita/pykrita/tile_grid/tile_grid.py", line 403, in load_last_preset
self.apply_preset(preset)
File "~/Library/Application Support/krita/pykrita/tile_grid/tile_grid.py", line 379, in apply_preset
self.margin_l.setValue(float(preset.get("margin_l", self.DEFAULT_MARGIN_L_PC)))
ValueError: could not convert string to float: '2,00'