[scribus-dev] 1.5.6svn and Python3

Gregory Pittman gpittman at iglou.com
Fri Nov 1 20:40:12 UTC 2019


One thing I am finding as a common error-generator is in scripts where there is error-checking to see if the script is being run in Scribus, e.g.

try:
    import scribus
except ImportError:
    print "Unable to import the 'scribus' module. This script will only run within"
    print "the Python interpreter embedded in Scribus. Try Script->Execute Script."
    sys.exit(1)

This generates a syntax error even if you're using the script in Scribus. Python3 requires parentheses to surround the text being printed:

try:
    import scribus
except ImportError:
    print ("Unable to import the 'scribus' module. This script will only run within")
    print ("the Python interpreter embedded in Scribus. Try Script->Execute Script.")
    sys.exit(1)

Fortunately, Python2 will accept such a command with the parentheses. I'll go through and see which included scripts might have this problem.

Greg



More information about the scribus-dev mailing list