Skip to content

Fix Python 3 compatibility and logging initialization#232

Open
alexhegit wants to merge 1 commit into
NVlabs:mainfrom
alexhegit:fix/python3-compat-logging-bugs
Open

Fix Python 3 compatibility and logging initialization#232
alexhegit wants to merge 1 commit into
NVlabs:mainfrom
alexhegit:fix/python3-compat-logging-bugs

Conversation

@alexhegit

Copy link
Copy Markdown

Summary

Two independent bug fixes:

1. Fix dict.keys()list() for Omni ArticulationView (simulator/newton/simulator.py)

In Python 3, dict.keys() returns a dict_keys view object, not a list. The Omni API's ArticulationView(include_joints=...) expects an actual sequence type (list/tuple). When _newton_dof_names is non-empty, passing dict.keys() directly causes a TypeError.

Before:

include_joints=self._newton_dof_names.keys(),

After:

include_joints=list(self._newton_dof_names.keys()),

2. Enable logging and faulthandler (train_agent.py)

log.info() and other logging calls were silently dropped because logging.basicConfig() was never called. This made debugging very difficult — all log messages simply vanished with no output.

Added:

import faulthandler
faulthandler.enable()
import logging
logging.basicConfig(level=logging.INFO, format="%(message)s", handlers=[logging.StreamHandler()])

Testing

  • Single GPU: Verified Epoch 0–16+ training runs end-to-end with all log output visible
  • Multi GPU (4× NVIDIA A30): Same, all 4 ranks log output correctly

Two bugs fixed:

1. simulator/newton/simulator.py:
   - Pass list() to ArticulationView.include_joints instead of dict_keys view.
     In Python 3, dict.keys() returns a view object, not a list.  The Omni
     API expects an actual sequence type, causing a TypeError when creating
     NewtonSimulator with non-empty robot dof names.

2. train_agent.py:
   - Add logging.basicConfig() so log.info() calls actually produce output.
     Without basicConfig, all logging calls are silently dropped.
   - Enable faulthandler for better crash traceback reporting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant