Commit b4ec122e authored by Maxime Perrotin's avatar Maxime Perrotin

Make code more python3-friendly

parent a16bdca4
......@@ -29,7 +29,7 @@ try:
from PySide.QtGui import *
from PySide.QtUiTools import *
except ImportError as err:
print 'Pyside not found (package python-pyside missing)...' + str(err)
print('Pyside not found (package python-pyside missing)...' + str(err))
import vn
......@@ -598,7 +598,7 @@ class asn1Editor(QTreeView):
ptr = getattr(ptr, "exist")
ptr = getattr(ptr, field_name)
present = ptr.Get()
print field_name, present, isAlwaysPresent, isAlwaysPresent
#print field_name, present, isAlwaysPresent, isAlwaysPresent
field_optionality.setCheckState (Qt.Checked if present
else Qt.Unchecked)
ptr.Reset(stateBefore)
......
......@@ -67,7 +67,12 @@ INT = Combine(Optional(oneOf("+ -")) + (Word(srange("[1-9]"), nums)|Literal('0')
# a lowercase followed by a-zA-z and -
#LID = Word(string.lowercase, string.letters+string.digits+'-')
# Update MP 21/11/12: made it tolerant to uppercase for the first character
LID = Word(string.letters, string.letters+string.digits+'-')
try:
LID = Word(string.letters, string.letters+string.digits+'-')
except AttributeError:
# python 3
LID = Word(string.ascii_letters, string.ascii_letters+string.digits+'-')
identifier = LID.setResultsName('IDENTIFIER')
# Value reference is in practice used to identify enumerated values
......@@ -164,7 +169,7 @@ def fromValueNotationToPySide(varName, string):
try:
return {varName: value.parseString(string, True)[0]}
except ParseException as err:
print '[fromValueNotationToPySide] Parsing error:', string
print('[fromValueNotationToPySide] Parsing error:', string)
raise
......@@ -324,4 +329,4 @@ if __name__ == '__main__':
''' Test application '''
import sys
if len(sys.argv)==2:
print fromValueNotationToPySide(sys.argv[1])
print(fromValueNotationToPySide(sys.argv[1]))
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