Old python tools in PYTHON_codes_and_scripts: Minimal python3 compatibility ensured
Although this part of the code (the "old" python tools) will ultimately disappear (replaced by the new Python interface currently developed, as well as the PyWIT code, which are both python3-compatible from the start), this MR is needed to ensure that other codes like DELPHI which are still using this module, can be made python3 compatible.
No functionality has been changed (except for a new print_warning
option - True
by default - added to the add_impedance_wake
function).
Most of the changes come from the 2to3
utility, and include:
- print statements (parentheses, and
print >>
to a file replaced bywrite
), -
list(...)
added when usingmap
,range
and.items()
, -
split
andreplace
functions (fromstring
module), replaced by the corresponding methods ofstr
objects, -
commands
replaced bysubprocess
.
NOTE: The code is still python2 compatible (and tested with the LHC impedance model).
WARNING: Some bugs may remain with python3, but at least the code can now be imported from a python 3 script without failing.
Edited by Nicolas Mounet