Scribus Forums

Scribus => Scripts and Plugins => Topic started by: skhullar on March 05, 2024, 07:06:38 AM

Title: difference between direct execute and via console
Post by: skhullar on March 05, 2024, 07:06:38 AM
Hi

Stuck with some trivial issues. Sorry if this sounds ridiculous.
Why does a standard sample script (c:\Program Files\Scribus 1.6.1\share\samples\wordcount.py), which executes correctly, gives multiple indentation error when executed from console?

thanks
SUnil
Title: Re: difference between direct execute and via console
Post by: a.l.e on March 05, 2024, 07:22:59 AM
good morning

the specific script works here, when i launch scribus from the console with that script.

enabling the hidden characters does not show any "stupid" indent errors, either.

of course, you can't run that script from the console, first you need to start scribus (even if somebody had the briliant idea to put "#!/usr/bin/env python" at the start; it will run but just tell you that you need to start the scribus from inside scribus).
Title: Re: difference between direct execute and via console
Post by: skhullar on March 05, 2024, 07:28:24 AM
Thanks ALE

The objective was to learn how to debug a script.
Hence was trying to use console as a tool.
Is that the correct method? Or what is the best practice?

Sunil
Title: Re: difference between direct execute and via console
Post by: a.l.e on March 05, 2024, 05:48:53 PM
basically, there are no best practices.

the problem being, that at some time you need to run the script from inside of scribus and i'm not sure how you can have a good debugging experience in this type of setting (but i'll try to shortly research that too)

one of these evenings, i will try to write a summary of the different way you can use with different types of scripts.
Title: Re: difference between direct execute and via console
Post by: a.l.e on March 07, 2024, 01:09:54 PM
here are some notes about debugging scribus scripts:

https://github.com/aoloe/scribus-manual-scripts/blob/master/content/debugging.md

feedback welcome!

ciao
a.l.e