1

I developing a script that will eventually use a pdfminer package to convert .pdfs to .txt files. In preparing the the subject files for use, I am having to import copy from xlutils.copy

from xlutils.copy import copy, I run into a syntax error from one of the copy.py associated python files (line 699 of xlutils\filter.py

def method(self,name,*args):
    if self.name:
        print repr(self.name),
    print "%s:%r"%(name,args)

the syntax error cursor points to the area of print repr(self.name) between the "r" and the left parenthesis. I discovered repr is not defined until line 825 of the filter.py script.

What could be the exact cause of the syntax error and is their any way to correct the script such that filter.py does not trip up the xlutils.copy command?

1 Answers1

0

In python3, the print command is significantly different. in particular you can't say print x. you have to say print(x). See https://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function

honi
  • 946
  • 1
  • 7
  • 18
  • Thanks, I corrected and it has allowed me to move forward...def method(self,name,*args): if self.name: print (repr(self.name)), print ("%s:%r"%(name,args)) Also had to add parentheses to print arguments on several associate files/scripts. – Jose Rodriguez Sep 13 '16 at 17:48
  • great! btw, this change is backwards compatible to 2.7 – honi Sep 13 '16 at 20:58