# Cannot see output of print statements

**URL:** <https://discuss.ray.io/t/cannot-see-output-of-print-statements/7913>\
**Category:** RLlib\
**Created:** [October 16, 2022, 5:57am UTC](https://discuss.ray.io/t/cannot-see-output-of-print-statements/7913 "2022-10-16T05:57:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Randy-Hodges](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/randy-hodges/32/3320_2.png) [@Randy-Hodges](https://discuss.ray.io/u/Randy-Hodges)\
**Post date:** [October 16, 2022, 5:57am UTC](https://discuss.ray.io/t/cannot-see-output-of-print-statements/7913/1 "2022-10-16T05:57:41Z")

</div>

**How severe does this issue affect your experience of using Ray?**

- Medium: It contributes to significant difficulty to complete my task, but I can work around it.

First off, sorry if my question is basic (I’m new to rllib), but I can’t seem to get things printed to my console when using rllib. I have copied some code from the example custom environment [ray/custom\_env.py at master · ray-project/ray · GitHub](https://github.com/ray-project/ray/blob/master/rllib/examples/custom_env.py)  
and while my training is running just fine, I only receive training summary output. None of the print statements that I insert result in any output to console. Even the pretty\_print() statement that came in the example code doesn’t seem to do anything. I feel like if I understood what was happening with the print statements, I would understand what might be happening with some of my other problems.

For an example of what I am talking about, no “printed” statements occur from the below code (also, idk how to fix the indentation for this, but it is similar to the link I posted):  
`
if args.no_tune:
# manual training with train loop using PPO and fixed learning rate
if args.run != “PPO”:
raise ValueError(“Only support --run PPO with --no-tune.”)
print(“Running manual train loop without Ray Tune.”)
ppo_config = ppo.DEFAULT_CONFIG.copy()
ppo_config.update(config)
# use fixed learning rate instead of grid search (needs tune)
ppo_config[“lr”] = 1e-3
trainer = ppo.PPO(config=ppo_config, env=dot_environment.dot_environment)
# run manual training loop and print results after each iteration
for _ in range(args.stop_iters):
print(“printed”)
result = trainer.train()
print(“printed”)
print(pretty_print(result))
print(“printed”)
# stop training of the target train steps or reward are reached
if (
result[“timesteps_total”] >= args.stop_timesteps
or result[“episode_reward_mean”] >= args.stop_reward
):
break
`

---

<div class="post-metadata">

**Author:** ![arturn](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/arturn/32/2096_2.png) [@arturn](https://discuss.ray.io/u/arturn)\
**Post date:** [November 30, 2022, 9:14pm UTC](https://discuss.ray.io/t/cannot-see-output-of-print-statements/7913/2 "2022-11-30T21:14:34Z")

</div>

Hi @Randy-Hodges ,

This should absolutely work! Are you sure that you properly provided `args.no_tune`? The print statements you inserted only get run if your interpreter actually enters this code branch. On my machine, this works and I’m pretty sure it would on others.

---

<div class="post-metadata">

**Author:** ![Randy-Hodges](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/randy-hodges/32/3320_2.png) [@Randy-Hodges](https://discuss.ray.io/u/Randy-Hodges)\
**Post date:** [December 10, 2022, 1:16am UTC](https://discuss.ray.io/t/cannot-see-output-of-print-statements/7913/3 "2022-12-10T01:16:11Z")

</div>

Reply, yes it works. I was running the code with an incorrect argument, that’s all. Thanks for the help. I was just being dumb because I was green
