except NameError:
pass
+# Python 2/3 compatibility for execfile function
+try:
+ execfile
+except:
+ def execfile(somefile, global_vars, local_vars):
+ with open(somefile) as f:
+ code = compile(f.read(), somefile, 'exec')
+ exec(code, global_vars, local_vars)
+
parser = src.options.Options()
parser.add_option('n', 'name', 'string', 'name',
_("""REQUIRED: the name of the module to create.
val = ""
while not tp.check_value(val):
- val = raw_input(tp.prompt)
+ val = input(tp.prompt)
if len(val) == 0 and len(tp.default) > 0:
val = tp.default
dico[tp.name] = val
for p in filter(lambda l: not dico.has_key(l), pyconfparam):
rep = ""
while len(rep) == 0:
- rep = raw_input("%s? " % p)
+ rep = input("%s? " % p)
dico[p] = rep
self.dico = dico
import datetime
import gzip
+# Compatibility python 2/3 for input function
+# input stays input for python 3 and input = raw_input for python 2
+try:
+ input = raw_input
+except NameError:
+ pass
+
verbose = False
try:
def ask_a_path():
"""
"""
- path = raw_input("enter a path where to save the result: ")
+ path = input("enter a path where to save the result: ")
if path == "":
- result = raw_input("the result will be not save. Are you sure to "
+ result = input("the result will be not save. Are you sure to "
"continue ? [y/n] ")
if result == "y":
return path
return ask_a_path()
elif os.path.exists(path):
- result = raw_input("Warning, the content of %s will be deleted. Are you"
+ result = input("Warning, the content of %s will be deleted. Are you"
" sure to continue ? [y/n] " % path)
if result == "y":
return path