programming-humanoid-robot-in-python icon indicating copy to clipboard operation
programming-humanoid-robot-in-python copied to clipboard

Make necessary changes for Python 3 in joint_control

Open kaka012 opened this issue 4 years ago • 0 comments

The changes have intentionally been kept minimal to make them easier to verify. The Notebooks would likely benefit from a re-run afterwards though, to upgrade their internal version numbers.

The fixes are as follows:

  • print(data) instead of print data, as print became a function in Python 3 instead of a keyword. Also f-Strings have been used, assuming a non-EOL-Python (supported since 3.6), since they are shorter than a .format().
  • open(filename, 'rb') for pickle.load since the latter requires a function returning bytes instead of strings so the file has to be opened in binary mode.
  • The imports in init.py have to be changed to be relative to the base module name. Otherwise just a ModuleNotFoundError: No module named 'hello' results.
  • In sexpr.py the import future has been dropped since it is obsolete and unused and the shebang has been dropped since the file has no main function.
  • In learn_posture.ipynb it has been noticed, that the listdir()-Function returns a list in arbitrary (undefined and may change from run to run) order. This has been resolved by simply sorting it.

kaka012 avatar Nov 17 '21 16:11 kaka012