Hello Nathan,
thank you for your reply.
I am working on making Python available from within Inkscape as opposed
to calling the interpreter externally in a separate instance, which is
the way it works currently. So in my branch, there is already a Python
console in the Inkscape GUI and the problem shows up the way you
described: If you run, for example _inkscape.runAction("file-open",
"test.svg") and "test.svg" cannot be opened an error message may be
written to the command line but nothing shows up in the Python console.
Unfortunately, the clean solution is not to just redirect the messages
to the Python console, because a Python script running an action should
be able to check for errors. Consequently, the error status (and maybe
messages) must be passed up to the caller of activate_action (the Python
interpreter in this case) such that useful Python exceptions and return
values and be constructed.
Regards,
Thomas
On 08.06.2020 02:36, Nathan P. Johansen wrote:
> This may be an odd suggestion but having an error console embedded in
> the GUI would be an enabled preference - essentially these are written
> to the command line (and therefore mostly lost to be insignificant) -
> but having a debugging window is what you are suggesting. It can
> capture and report the state of the program as well as protect against
> failures that would cause loss of work which (if designed
> intentionally could be dumped as a save prior to any critical check
> that may cause an application crash) to be saved before failure. Is
> that what you mean? =)
>
> -N
>
> Sent from my iPhone
>
>> On Jun 7, 2020, at 11:15 AM, wiesi(a)posteo.net wrote:
>>
>> Hello everyone,
>>
>> is there a possibility to get some error status and/or error messages
>> when executing actions via, e.g., activate_action()? I had a look at
>> the glibmm documentation but couldn't find anything regarding this
>> topic.
>>
>> I've just included executing Inkscape actions from the internal Python
>> interpreter feature I'm porting to the current master branch
>> (
https://gitlab.com/wiesi/inkscape/-/tree/python-internal-1) and it
>> would be nice (maybe even mandatory) for the Python user to get some
>> feedback whether an action was successful and a meaningful error
>> message if not.
>>
>> Can anyone point me in the right direction? Does glibmm have some
>> infrastructure for this task that I'm just unable to find or does it
>> really require some extended surgery?
>>
>> Thanks,
>> Thomas
>>
>> _______________________________________________
>> Inkscape Devel mailing list -- inkscape-devel(a)lists.inkscape.org
>> To unsubscribe send an email to
>> inkscape-devel-leave(a)lists.inkscape.org
> _______________________________________________
> Inkscape Devel mailing list -- inkscape-devel(a)lists.inkscape.org
> To unsubscribe send an email to inkscape-devel-leave(a)lists.inkscape.org