Inkscape.org
Creating New Extensions Extension aborting execution
  1. #1
    nicolascc nicolascc @nicolascc

    Hi! I'm noticing that the extensions abort without doing anything or a popup message with the error when there are many selected elements (more than 2000). I'm testing with this code

    elements = self.svg.selection
    inkex.utils.debug(len(elements))

    and the extension just closes and doesn't do anthing. 

    There is a way to overcome this?

  2. #2
    inklinea inklinea @inklinea⛰️

    I usually use inkex.errormsg("text") 

    however, it does corrupt if it has to output huge amounts of text.

    As a workaround I use something like this:

    os_tempdir = tempfile.gettempdir()

    def write_debug_file(data, filename):

        debug_temp_filepath = os.path.join(os_tempdir, filename)

        with open(debug_temp_filepath, mode='a', encoding='utf-8') as file:
            file.write(str(data))
            file.close()

  3. #3
    nicolascc nicolascc @nicolascc
    inklinea

    I usually use inkex.errormsg("text")

    Thank you for the feedback, nevertheless this was an example of the Software crashing with too much path objects, more than 2000, doing a simple function.  There is something I'm doing wrong? or there is a limit of number of selected objects to run an extension?