Scribus Forums

Scribus => Scripts and Plugins => Topic started by: jlpoole on June 17, 2015, 05:02:33 AM

Title: Logging (Especially For Windows)
Post by: jlpoole on June 17, 2015, 05:02:33 AM
I've built a basic logging function using the format of modules so that logging may be accomplished with a simple:
printD("log this comment")
printDt("log that comment with a tab")


The log files have date and timestamps before each entry, separated by a space for printD and a tab for printDt.

If I see several people saying this would be useful to them, I'll go ahead and try to share it.

I found being unable to log stuff in Windows really hampered my ability to debug and develop.

I've also address how to create modules under the share/scripts directory so that libraries of useful routine may be built -- this is something I see that is much needed here.
Title: Re: Logging (Especially For Windows)
Post by: a.l.e on June 17, 2015, 10:50:09 AM
yep, indeed on windows it must be hard to get feedback from the scripter!

one thing i did, and never really documented, is to create a fake Scribus class (a mock...) that enables to run the python script outside of scribus, making it much easier to test it from your preferred environment.

you can see it in action here:

https://github.com/aoloe/scribus-script-repository/blob/master/typographic-grid/typographic-grid.py

(if it fails importing scribus (which will happen if the script is not run inside of scribus), it will create a Scribus class with the methods used in the Scribus).

if there is an interest for it, we/i can look for a way to make that more general (eventually mock the full API?) and document it...
but it's not one of my priorities right now...
Title: Re: Logging (Especially For Windows)
Post by: Rummidge on June 30, 2015, 05:24:53 PM
I am using it!

Thanks for making life easier.  ;D

I wonder if there is a way for using PyDev (Eclipse) remote debugging facilities, as it would be fantastic to set breakpoints, inspect variable names and so on...

Meanwhile, your hack is really helpful.