Image Advanced Wizard

Previous topic - Next topic

Watkins

In Scribus 1.5.8 (Windows x64), we are trying to use the 'Image Advanced Wizard' script from the official site and this error is appearing -

Traceback (most recent call last):
  File "<string>", line 11, in <module>
  File "<string>", line 29
    print "This script requires Python's Tkinter properly installed."
                                                                    ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("This script requires Python's Tkinter properly installed.")?


We edited the code and added the missing brackets which simply displays the error message correctly.

This was working fine on 1.4.8 and we had to upgrade to 1.5.8 to be able to retain PNG image transparency - all the other scripts work just fine, this is the only one which is not working.

The script was obtained from here - https://wiki.scribus.net/canvas/Image_Wizard_Advanced

Any help on getting this working again would be thoroughly appreciated as this has completely broken our workflow - many thanks for your time!

AdmFubar

There are changes in the scribus pything api. Scribus now uses Python 3 now in the  1.5 series. these changes are probably what is impacting the functionality of this script.
Using Scribus 1.6.1, openSUSE 15.6
Advanced hobbyist

Watkins

Hi @AdmFubar - thank you for your reply and for bringing this to light.

Our coding knowledge in python is incredibly limited and I don't have the faintest idea where to start in rectifying this script - is there anyone who would be able to edit this to get it working?

To be honest, the functions we require are to scale multiple images to fit frame proportionally and to replace multiple images at once - if we could at least get this working that would be excellent.

Hope you're keeping well and thanks again for your time!

AdmFubar

I've had the need for this and want to update or create from scratch a working version of this. Learning cuve is a little rough for me at the moment, medical issue may interfereing.  It has been a while since i've coded anything. but i'm plugging along.  Just dont count on me at this time finishing it soon.
Using Scribus 1.6.1, openSUSE 15.6
Advanced hobbyist

Watkins

Thanks for getting back to me and amazing news that you also have the need for the script and are working through it!

We spent ages looking through the code and addressing each error one by one and have gotten all the way down to 'haveDoc' at the bottom of the file being called as an error - maybe this will help you in some way or you'd be able to fix the last elements, code is at the link below as I exceeded the character length of the post by pasting it in.

https://justpaste.it/7jzfd

Hope you're doing well regarding the medical issue as well and wishing you all the best, thanks again for your time!

a.l.e

#5
i wonder what your definition of ages is : - )

in your pastebin, you added the (obviously missing) brackets for the print (which you could simply have delete, since it's basically useless).

the rest of the script is working correctly (by some definition of correctly) here with a somehow up to date version of scribus.
(ok, i was too lazy, to really load two images in the frames and could not see any change happening).

if it does not work for you, it's probably because tkinter is not correctly installed.
you don't day what kind of errors you are experiencing, so it's a bit hard to judge.

finally, i've now removed the print from the version in the wiki.
that script should now run (even if i'm not convinced that it's a good script... way too complex for not much, imo)

Watkins

Hi a.l.e thanks for getting back to us!

When you have essentially zero knowledge in python and the script is essential for your workflow, ages is hours and at this point possibly into double digits!

We added the brackets as you mentioned before, we also changed some import strings and the syntax for some commands - running the pastebin version I edited gives this error message

---------------------------
Script error
---------------------------
<qt><p>If you are running an official script report it at <a href="http://bugs.scribus.net">bugs.scribus.net</a> please.</p><pre>Traceback (most recent call last):
  File &quot;&lt;string&gt;&quot;, line 695, in main
NameError: name 'haveDoc' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File &quot;&lt;string&gt;&quot;, line 11, in &lt;module&gt;
  File &quot;&lt;string&gt;&quot;, line 704, in &lt;module&gt;
  File &quot;&lt;string&gt;&quot;, line 700, in main
NameError: name 'haveDoc' is not defined
</pre><p>This message is in your clipboard too. Use Ctrl+V to paste it into bug tracker.</p></qt>
---------------------------
OK   
---------------------------

When running the newly updated script on the wiki we just get the generic "This script requires Python's Tkinter correctly installed."

The script runs absolutely fine on 1.4.8 Windows x64, any version of 1.5.x gives the same error on Windows. We also tried this on a Mac 1.5.x and not even the bundled scripts run, they also give the same generic error message that Tkinter is not correctly installed.

All the official scripts on Windows x64 1.5.x are working fine, it's just this one we can't get to work - again not even the official ones run on Mac 1.5.x when installing Scribus out of the box.

We've searched very hard for an answer to how to correctly install Tkinter, I spent an entire night the other night trying to fix this so we could start processing images on the Mac but had to settle with Boot Camping the Mac to Windows as we could not get it to work.

If there are known steps we can do to get Tkinter to work then we are absolutely willing to try as we'd love to get the scripts working across the board.

On a side note, we actually found your patch for 1.5.4 which added the function of exporting PNG with a transparent background - this is the only reason we upgraded to 1.5.x as we need this function - https://bugs.scribus.net/view.php?id=15455 - if it is possible to get this function working for 1.4.8 then this would serve as a workaround at least for now.

If you need any more info/error messages etc then let me know and I'll get them through asap.

Thank you again for your time and expertise, we're trying our best to get this working so any help would be thoroughly appreciated!

a.l.e

#7
so, i got a windows computer running, and i'm testing this for you..

i did some research and the official documentation hints to tkinter being provided by default with python.

and scribus for windows provides python.

it should just work.

i copied the script from the wiki and tried to run it: it complains about tk.

so, let's check if tkinter works in scribus.

i did an internet search and found:

https://docs.python.org/3/library/tkinter.html

i then took the hello world from that page

https://docs.python.org/3/library/tkinter.html#a-hello-world-program


from tkinter import *
from tkinter import ttk
root = Tk()
frm = ttk.Frame(root, padding=10)
frm.grid()
ttk.Label(frm, text="Hello World!").grid(column=0, row=0)
ttk.Button(frm, text="Quit", command=root.destroy).grid(column=1, row=0)
root.mainloop()


and pasted it into Script > Show Console:

eureka. i see the "hello world" dialog.

so, the problem is within the script, not scribus.

let's compare the two scripts...

oh, in the "hello world" tkinter is written in lower case...
let's fix that.

still complains...

what's font import? let's comment it out...

eureka^2

the dialog shows.

now, i see that you already fixed that in your version.

all i can tell at this point: the script, as it is now in the wiki, should work in a fresh scribus, in its latest published version.

i would be glad, if other people can confirm that.

i still have no clue how this script is supposed to work and what it can do for you, but if it still does not work for you and you really think you need it:

- download and install a fresh copy of scribus (and if you have the same version installed, first make sure that that version is uninstalled; other versions can stay).
- download a fresh version of the script from the wiki.
- run them all.

and make sure that you run the scribus and script you just downloaded!

good luck...
a.l.e

Watkins

Hi a.l.e,

That works like an absolute charm thank you so much - I can confirm that in Scribus 1.5.8 on Windows x64 that the script which is currently on the wiki is working 100% from what we can decipher.

Thank you for spending the time to look through this all, we really appreciate your swift and thorough responses - we tried our best however required some expertise to get the job finished.

All the best and hope you're keeping well!