New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DM-7152: Port to python 3 #83
Conversation
Python 2.7 supports both and Python 3 does not support PyString.
ee8b9ad
to
8837fc7
Compare
@@ -176,10 +179,10 @@ def run(): | |||
) | |||
destExposure.setWcs(destWcs) | |||
dTime, nIter, goodPix = timeWarp(destExposure, srcExposure, warpingControl) | |||
print "%4d %5d %8.1f %6.1f, %6.1f %7.1f %10s %8d %6.2f" % ( | |||
print("%4d %5d %8.1f %6.1f, %6.1f %7.1f %10s %8d %6.2f" % ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not using new style print formatting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching to format
is not required by the Python 3 migration. In fact, use of format
at all is highly contentious. I always use format
in new code as I grew up with Python 3.
This was needed as there were some tab/space inconsistencies and Python 3 does not like that.
These routines are not portable to python 3. Replace with a simple regex substitution.
e.message is not supported on python3.
If lsst.display is not loadable you get a SystemError on Python3 when trying to do an import relative to it. You do not get ImportError. Trap for both errors. Also check that _impl attribute exists before using it. Sometimes the close() method can be called without the object completing initialization.
…ytes Uses the SWIG helper function to handle python versions.
In modern python next method is named __next__. Without this change classes can not act as iterators. Keep next around for compatibility.
Put long ahead of int in the aliases dict so that in python3 int is mapped to I. It may be that we should keep it as L and change the test. On Python 3 long does not exist and int is a long.
Now that future division is enabled it is important that these divisions still return integers.
and map it to String as it behaves exactly like a string.
This does not work on Python 3: try: throw except as e: pass print(e) as the "e" is not in scope outside of the exception. The exception needs to be copied to another variable. Do not specify a root package if we know we are trying an absolute import.
Sometimes the object can die before it has been initialized.
This should ensure we get bytes objects in both Python 2 and Python 3. Returns PyObject None instead of void to propagate errors.
@pschella @TallJimbo Everything is read to merge except |
testCameraGeom's testTransformDet method only tested a subset of detectors, and depending on which subset it tested (which depended on the order in which dict keys were returned) the test could fail. Fixed by testing all detectors.
Includes some code cleanup. Not working yet.