Author Topic: Possible to debug scripter script?  (Read 845 times)

Juha

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
  • Scribus User
Possible to debug scripter script?
« on: October 25, 2016, 11:33:55 am »
I am running python scripts in Scribus scripter. I would like to debug these scripts. I an using system default python interpreter as instructed here: https://wiki.scribus.net/canvas/Windows_Full_Python_Integration. I am using PyCharm IDE for python but the problem is that running scripter script cannot be found in PyCharm "attach to process" list. Is there any way to debug Scribus scripts?

a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1299
  • Karma: 19
    • the graphics lab
Re: Possible to debug scripter script?
« Reply #1 on: October 25, 2016, 11:59:32 am »
I don't know if there is a way to do it, but I can image that there is none. (or none that is easy to activate).

What I've done in the past, is to mock the Scripter API and run the script outside of Scribus.

You can see here, how such a "Scribus" class can look like:

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

during the lunch break, I'll create a "standalone" script that one import the code.

if you start using the code, please contribute back your changes! (currently, the class only contains the methods I was using)

Juha

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
  • Scribus User
Re: Possible to debug scripter script?
« Reply #2 on: October 25, 2016, 12:48:41 pm »
To create class named Scribus is the method I am already used and it has been helpful to find errors in script. Anyway it is not running in Scribus and is a kind of poor man alternative.

a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1299
  • Karma: 19
    • the graphics lab
Re: Possible to debug scripter script?
« Reply #3 on: October 25, 2016, 02:01:07 pm »
yeah, that's no solution , i know!

feel free to contribute enhancement to https://github.com/aoloe/scribus-script-repository/tree/master/mockAPI , though...

and if you find a real solution, don't forget to share it in here :-)

 

palmate