-1

I was following this repo for installing files2rouge, then i got an error as below:

Traceback (most recent call last):
  File "setup_rouge.py", line 7, in <module>
    from files2rouge import settings
  File "/home/cerdas/files2rouge/files2rouge/__init__.py", line 2, in <module>
    from files2rouge.files2rouge import main
  File "/home/cerdas/files2rouge/files2rouge/files2rouge.py", line 17, in <module>
    from files2rouge import utils
  File "/home/cerdas/files2rouge/files2rouge/utils.py", line 16
    print(file=saveto, *args, **kwargs)
              ^
SyntaxError: invalid syntax

Here the line of code that encountered the error:

def tee(saveto, *args, **kwargs):
    """Mimic the tee command, write on both stdout and file
    """
    print(args, kwargs)
    if saveto is not None:
        print(file=saveto, *args, **kwargs)

I have no idea whats wrong, and not sure what is saveto for. Please give me some insight, thanks.

Aran-Fey
  • 39,665
  • 11
  • 104
  • 149
Bily
  • 51
  • 9
  • 2
    How exactly is this question different from [the one you asked an hour ago](https://stackoverflow.com/questions/52418360/syntaxerror-printargs-kwargs)? – Aran-Fey Sep 20 '18 at 07:32

1 Answers1

0

print is a statement in Python 2 and only becomes a function in Python 3, but if you want to use it as a function in Python 2, you can add:

from __future__ import print_function

before you use the print function.

blhsing
  • 91,368
  • 6
  • 71
  • 106