Commit 5c264dcb8a36d6f0e0a77e63b6f9414fafcc50ac
1 parent
fb95b2f2
Handles different import syntax on Python 2 and Python 3 in __init__.py.
Showing
1 changed file
with
7 additions
and
2 deletions
pyext/ctools/__init__.py.in
| 1 | # ========================================================================== | 1 | # ========================================================================== |
| 2 | # ctools Python module | 2 | # ctools Python module |
| 3 | # | 3 | # |
| 4 | -# Copyright (C) 2015 Juergen Knoedlseder | 4 | +# Copyright (C) 2015-2016 Juergen Knoedlseder |
| 5 | # | 5 | # |
| 6 | # This program is free software: you can redistribute it and/or modify | 6 | # This program is free software: you can redistribute it and/or modify |
| 7 | # it under the terms of the GNU General Public License as published by | 7 | # it under the terms of the GNU General Public License as published by |
| @@ -21,7 +21,12 @@ | @@ -21,7 +21,12 @@ | ||
| 21 | import gammalib | 21 | import gammalib |
| 22 | 22 | ||
| 23 | # Import sub modules | 23 | # Import sub modules |
| 24 | -from .tools import * | 24 | +#from .tools import * |
| 25 | +import sys | ||
| 26 | +if sys.version_info[0] < 3: | ||
| 27 | + from tools import * | ||
| 28 | +else: | ||
| 29 | + from .tools import * | ||
| 25 | 30 | ||
| 26 | # Remove swig register stuff | 31 | # Remove swig register stuff |
| 27 | bad_entries = [entry for entry in list(locals()) | 32 | bad_entries = [entry for entry in list(locals()) |