Skip to content

Commit 783fc99

Browse files
committed
Made all examples support python2
Signed-off-by: Deepanshu <deepanshu2017@gmail.com>
1 parent bd5dc75 commit 783fc99

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

examples/PhaseSpace/phsp_averaging_functor.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,15 @@ def main():
5757

5858
# Device #
5959

60-
print()
61-
print(constants.RED, "ERROR: device is not supported with custom functors in current HydraPython version.", sep='')
62-
print(constants.RESET)
60+
if sys.version_info.major == 2:
61+
print
62+
sys.stdout.write(constants.RED)
63+
print "ERROR: device is not supported with custom functors in current HydraPython version."
64+
sys.stdout.write(constants.RESET)
65+
else:
66+
print()
67+
print(constants.RED, "ERROR: device is not supported with custom functors in current HydraPython version.")
68+
print(constants.RESET)
6369

6470
# Host #
6571
start = time.time()

examples/PhaseSpace/phsp_evaluating_functor.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,16 @@ def main():
5656

5757
# Device #
5858

59-
print()
60-
print(constants.RED, "ERROR: device is not supported with custom functors in current HydraPython version.", sep='')
61-
print(constants.RESET)
59+
if sys.version_info.major == 2:
60+
print
61+
sys.stdout.write(constants.RED)
62+
print "ERROR: device is not supported with custom functors in current HydraPython version."
63+
sys.stdout.write(constants.RESET)
64+
else:
65+
print()
66+
print(sys.version_info.major)
67+
print(constants.RED, "ERROR: device is not supported with custom functors in current HydraPython version.")
68+
print(constants.RESET)
6269

6370
# Host #
6471
result = hypy.host_vector_float2(nentries)

0 commit comments

Comments
 (0)