Scribusoid

Author Topic: Importing XML into Scribus  (Read 1344 times)

Rob Dixon

  • Newbie
  • *
  • Posts: 25
  • Karma: 0
  • Scribus User
Importing XML into Scribus
« on: May 09, 2016, 04:04:18 pm »
Whilst I have plenty of computing experience, I am a total novice when it comes to Scribus, publishing packages in general, Python, Python scripts, etc so would appreciate some help. I wish to import XML into Scribus.

I have tried to create a Python script "FormatXML", taken from the page
https://wiki.scribus.net/canvas/Formatxml

I copied the complete code in the box headed Source, without any change, into a .txt file using notepad and changed the extension to py. I then tried to execute the script in Scribus but got the following error.

Traceback (most recent call last):
  File "<string>", line 8, in <module>
  File "C:\XML script\FormatXML.py", line 179, in <module>
    main_wrapper()
  File "C:\XML script\FormatXML.py", line 165, in main_wrapper
    main()
  File "C:\XML script\FormatXML.py", line 148, in main
    xml_file = getFile("XML File", 'XML (*.xml)')
TypeError: getFile() takes exactly 4 arguments (2 given)

Unfortunately, this means nothing to me. I can only find two references to FormatXML, without the extension .py and cannot find any reference to py

I hope that someone is kind enough to put me out of my misery!

Many thanks

Rob Dixon


Nermander

  • Hero Member
  • *****
  • Posts: 1133
  • Karma: 15
Re: Importing XML into Scribus
« Reply #1 on: May 10, 2016, 08:55:45 am »
  File "C:\XML script\FormatXML.py", line 148, in main
    xml_file = getFile("XML File", 'XML (*.xml)')
TypeError: getFile() takes exactly 4 arguments (2 given)

The above quoted part is the error message. In line 148 in your file there is a call to the getFile() function with to few arguments.

To me it looks as a bug in the code.

The call is
Code: [Select]
       xml_file = getFile("XML File", 'XML (*.xml)')
but the function is defined as
Code: [Select]
def getFile(caption, filter, defaultname, issave):
But I don't know enough Python to know if there is some settings telling that some arguments are optional.

Rob Dixon

  • Newbie
  • *
  • Posts: 25
  • Karma: 0
  • Scribus User
Re: Importing XML into Scribus
« Reply #2 on: May 10, 2016, 11:16:14 am »
Many thanks, Nermander. You may well be right that there are too few arguments, but it is way outside my comfort zone! Have you any idea how I might be able to find an answer?

Rob Dixon

  • Newbie
  • *
  • Posts: 25
  • Karma: 0
  • Scribus User
Re: Importing XML into Scribus
« Reply #3 on: May 10, 2016, 08:41:08 pm »
Scribus has sent me the code for a new script and this now works. I have actually imported some XML into Scribus. Now I have to learn about Scribus.