0

I'm trying to get this program apfel to run on my Ubuntu 20.04. I believe I have installed it successfully. When I run apfel in the terminal, I got the following error message:

File "/usr/local/bin/apfel", line 12
    print "Module readline not available."
          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Module readline not available.")?

This is the content of the program apfel in usr/local/bin:

#!/usr/bin/python

import sys
import os
import inspect
#from lhapdf import *
import apfel

try:
    import readline
except ImportError:
    print "Module readline not available."
else:
    import rlcompleter
    readline.parse_and_bind("tab: complete")

def apfelhelp():
    print "Available apfel functions:"
    print dir(apfel)

from apfel import *

#red color
r = "\033[31m"

#whie color
w = "\033[0m"

#clear the terminal
os.system('clear')

print "\nWelcome to "
print "     _/_/_/    _/_/_/_/   _/_/_/_/   _/_/_/_/   _/"
print "   _/    _/   _/    _/   _/         _/         _/"
print "  _/_/_/_/   _/_/_/_/   _/_/_/     _/_/_/     _/"
print " _/    _/   _/         _/         _/         _/"
print "_/    _/   _/         _/         _/_/_/_/   _/_/_/_/"
print "_____v", GetVersion(),"A PDF Evolution Library, arXiv:1310.1394"      
print "     Authors: V. Bertone, S. Carrazza, J. Rojo"
print "\n Type apfelhelp() for help\n"


EnableWelcomeMessage(False)

#custom prompt
sys.ps1 = r + "[apfel]: " + w
os.environ['PYTHONINSPECT'] = 'True'

As I understand it the program starts up python first, then run import readline, it is not successful and thus try to print the error message, but got the error because of the lack of parentheses.

However when I start up python myself (I have python 3 I believe) and type in import readline I encounter no issues. Can anyone see where the problem might be?

Lepnak
  • 1

1 Answers1

1

The program you are trying to run is a python script. It should be coded according to the correct syntax. print "Module readline not available." is not valid syntax in Python 3. It should read print("Module readline not available.").

Either correct the code yourself, or file an issue to the developper.

vanadium
  • 82,909
  • 6
  • 116
  • 186