Commit 9a22fd59d538c986dfe10f6d10b11fdffd33b7e9
1 parent
ed322a40
Python 3 fixes for ctool scripts
Showing
3 changed files
with
18 additions
and
18 deletions
pyext/ctools/obsutils.py
scripts/obsutils.py
| 1 | -print "The obsutils are moved under the ctools module." | |
| 2 | -print "Please update your script to import from ctools, i.e:" | |
| 3 | -print "from ctools import obsutils" | |
| 1 | +print("The obsutils are moved under the ctools module.") | |
| 2 | +print("Please update your script to import from ctools, i.e:") | |
| 3 | +print("from ctools import obsutils") | |
| 4 | 4 | |
| 5 | 5 | from ctools.obsutils import * | ... | ... |
scripts/tsmerge.py
| ... | ... | @@ -7,18 +7,18 @@ import glob |
| 7 | 7 | import json |
| 8 | 8 | |
| 9 | 9 | def print_help(): |
| 10 | - print "" | |
| 11 | - print "tsmerge.py expects two keyword argumens: use via command line as follows" | |
| 12 | - print "tsmerge.py files=<list of files> outfile=<desired outfile name>" | |
| 13 | - print "-------------------------------------------------------------------------" | |
| 14 | - print "*** \"outfile\" should be a path to a fits file" | |
| 15 | - print "*** \"files\" should be either be:" | |
| 16 | - print " - an ascii-file listing the files your want to merge" | |
| 17 | - print " OR - a wildcard string describing the files for merging" | |
| 18 | - print "-------------------------------------------------------------------------" | |
| 19 | - print "" | |
| 20 | - print "Example: python tsmerge,py files=tsmap*.fits outfile=tsmap.fits" | |
| 21 | - print "" | |
| 10 | + print("") | |
| 11 | + print("tsmerge.py expects two keyword argumens: use via command line as follows") | |
| 12 | + print("tsmerge.py files=<list of files> outfile=<desired outfile name>") | |
| 13 | + print("-------------------------------------------------------------------------") | |
| 14 | + print("*** \"outfile\" should be a path to a fits file") | |
| 15 | + print("*** \"files\" should be either be:") | |
| 16 | + print(" - an ascii-file listing the files your want to merge") | |
| 17 | + print(" OR - a wildcard string describing the files for merging") | |
| 18 | + print("-------------------------------------------------------------------------") | |
| 19 | + print("") | |
| 20 | + print("Example: python tsmerge,py files=tsmap*.fits outfile=tsmap.fits") | |
| 21 | + print("") | |
| 22 | 22 | sys.exit(-1) |
| 23 | 23 | |
| 24 | 24 | |
| ... | ... | @@ -105,7 +105,7 @@ class maps: |
| 105 | 105 | self.maps[j][i] = addmaps[j][i] |
| 106 | 106 | # Unify error messages |
| 107 | 107 | def error(self,message): |
| 108 | - print "*** ERROR ***: "+message | |
| 108 | + print("*** ERROR ***: "+message) | |
| 109 | 109 | sys.exit(-1) |
| 110 | 110 | |
| 111 | 111 | |
| ... | ... | @@ -149,7 +149,7 @@ if __name__ == "__main__": |
| 149 | 149 | # Initialise list of files |
| 150 | 150 | |
| 151 | 151 | kwargs = get_kwargs(sys.argv[1:]) |
| 152 | - if not kwargs.has_key("outfile") or not kwargs.has_key("files"): | |
| 152 | + if "outfile" not in kwargs or "files" not in kwargs: | |
| 153 | 153 | print_help() |
| 154 | 154 | outfile = kwargs["outfile"] |
| 155 | 155 | files = kwargs["files"] | ... | ... |