Commit e37c9c60 authored by Momme Butenschoen's avatar Momme Butenschoen

Ensured compability for python 2.6 upwards and python 3 in one file, specific...

Ensured compability for python 2.6 upwards and python 3 in one file, specific python3 script is therfore obsolete.
parent 36a69965
#!/bin/bash
#
#BOP
# !DESCRIPTION:
# Convert to python 3. The script converts the file in the file
# argument to python. It creates the converted file in th py3 sub-folder.
# Additionaly the shell invokation will be changed to
# explicitly invoke python3.
#EOP
file=PyProTex.py
mkdir -p py3
2to3 -p -n -w -o py3 $file
# make the shell invokation python3 instead of python
sed -i "s/\#\!\/usr\/bin\/python\b/\#\!\/usr\/bin\/python3/" py3/$file
...@@ -340,7 +340,7 @@ class PyProTex: ...@@ -340,7 +340,7 @@ class PyProTex:
try: try:
fid=open(self.InputFile,'r') fid=open(self.InputFile,'r')
except: except:
raise RunTimeError,"Unable to open {}".format(self.InputFile) raise RunTimeError("Unable to open {}".format(self.InputFile))
# Print page header # Print page header
# ----------------- # -----------------
...@@ -1042,7 +1042,7 @@ class PyProTex: ...@@ -1042,7 +1042,7 @@ class PyProTex:
def check_error(self,flag,tag): def check_error(self,flag,tag):
"""Raise prologue status error flag is False.""" """Raise prologue status error flag is False."""
if not flag: if not flag:
raise RunTimeError,"ProTeX: invalid prologue, missing {}: in {}".format(tag,self.name_is) raise RunTimeError("ProTeX: invalid prologue, missing {}: in {}".format(tag,self.name_is))
def hed_item(self,): def hed_item(self,):
self.Str+="\\bigskip\n{{ \\bf \sf \n" self.Str+="\\bigskip\n{{ \\bf \sf \n"
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment