diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 46cd745..eccf4d3 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -26,6 +26,9 @@ Fixed
   <https://github.com/omni-us/jsonargparse/issues/362>`__).
 - ``ActionJsonSchema`` not setting correctly defaults when schema uses
   ``oneOf``.
+- Recommended ``print_config`` steps not working when ``default_config_files``
+  used due to the config file initially being empty (`#367
+  <https://github.com/omni-us/jsonargparse/issues/367>`__).
 
 
 v4.24.0 (2023-08-23)
diff --git a/jsonargparse/_core.py b/jsonargparse/_core.py
index 014f056..778613c 100644
--- a/jsonargparse/_core.py
+++ b/jsonargparse/_core.py
@@ -631,6 +631,8 @@ class ArgumentParser(ParserDeprecations, ActionsContainer, ArgumentLinking, argp
             cfg_dict = load_value(cfg_str, path=cfg_path, ext_vars=ext_vars)
         except get_loader_exceptions() as ex:
             raise TypeError(f"Problems parsing config: {ex}") from ex
+        if cfg_dict is None:
+            return Namespace()
         if not isinstance(cfg_dict, dict):
             raise TypeError(f"Unexpected config: {cfg_str}")
         return self._apply_actions(cfg_dict, prev_cfg=prev_cfg)

diff --git a/jsonargparse_tests/test_core.py b/jsonargparse_tests/test_core.py
index 950420b..efd4df2 100644
--- a/jsonargparse_tests/test_core.py
+++ b/jsonargparse_tests/test_core.py
@@ -698,6 +698,15 @@ def test_print_config_invalid_flag(print_parser):
     ctx.match('Invalid option "invalid"')
 
 
+@pytest.mark.skipif(sys.version_info[:2] == (3, 6), reason="not supported in python 3.6")
+def test_print_config_empty_default_config_file(print_parser, tmp_cwd):
+    default_config_file = tmp_cwd / "defaults.yaml"
+    default_config_file.touch()
+    print_parser.default_config_files = [default_config_file]
+    out = get_parse_args_stdout(print_parser, ["--print_config"])
+    assert yaml.safe_load(out) == {"g1": {"v2": "2"}, "g2": {"v3": None}, "v1": 1}
+
+
 def test_default_config_files(parser, subtests, tmp_cwd):
     default_config_file = tmp_cwd / "defaults.yaml"
     default_config_file.write_text("op1: from default config file\n")

Unexpected config error when a default config file is empty
## 🐛 Bug report

If at least one `default_config_files` is set and this file is empty, a `TypeError: Unexpected config: ` is triggered on `parser.parse_args()`. Even if no argument is mandatory.

### To reproduce

```python
from jsonargparse import ArgumentParser

parser = ArgumentParser(default_config_files=['config.yaml'])
parser.add_argument("test", type=int, help="test", default=1)
cfg = parser.parse_args()
print(cfg.as_dict())
```

**no 'config.yaml' file**
```bash
python main.py
> {'test': 1}
```
Work as expected, no error

**empty 'config.yaml' file**
```bash
touch config.yaml
python main.py
> Unexpected config error:
```

**Not empty 'config.yaml' file**
Work as expected, no error
```bash
echo "test: 42" > config.yaml
python bug.py
> {'test': 42, '__default_config__': Path_fr(config.yaml, cwd=/Users/...)}
```

### Expected behavior

I expect to have the same behavior between no configuration file and empty configuration file.
In the case where every argument are optional I don't expect to have an error.

In my case I wanted to generate this default configuration file as suggest [in the document](https://jsonargparse.readthedocs.io/en/v4.24.0/#writing-configuration-files) with:

```bash
python example.py --print_config > config.yaml
````

But an empty file is created before to run the script. Which trigger the issue mentioned above.

### Environment

- jsonargparse version: 4.24.0
- Python version: 3.11.4
- How jsonargparse was installed: `pip install jsonargparse[signatures]~=4.24 docstring-parser~=0.15 PyYAML~=6.0 ruyaml~=0.91`
- OS: macOS 13.4.1

jsonargparse_tests/test_core.py::test_print_config_empty_default_config_file
jsonargparse_tests/test_core.py::test_parse_args_simple jsonargparse_tests/test_core.py::test_parse_args_nested jsonargparse_tests/test_core.py::test_parse_args_unrecognized_arguments jsonargparse_tests/test_core.py::test_parse_args_invalid_args jsonargparse_tests/test_core.py::test_parse_args_base_namespace jsonargparse_tests/test_core.py::test_parse_args_unexpected_kwarg jsonargparse_tests/test_core.py::test_parse_args_nargs_plus jsonargparse_tests/test_core.py::test_parse_args_nargs_asterisk jsonargparse_tests/test_core.py::test_parse_args_nargs_questionmark jsonargparse_tests/test_core.py::test_parse_args_nargs_number jsonargparse_tests/test_core.py::test_parse_args_positional_nargs_questionmark jsonargparse_tests/test_core.py::test_parse_args_positional_nargs_plus jsonargparse_tests/test_core.py::test_parse_args_positional_config jsonargparse_tests/test_core.py::test_parse_args_choices jsonargparse_tests/test_core.py::test_parse_object_simple jsonargparse_tests/test_core.py::test_parse_object_nested jsonargparse_tests/test_core.py::test_env_prefix_from_prog_with_dashes jsonargparse_tests/test_core.py::test_parse_env_simple jsonargparse_tests/test_core.py::test_parse_env_nested jsonargparse_tests/test_core.py::test_parse_env_config jsonargparse_tests/test_core.py::test_parse_env_positional_nargs_plus jsonargparse_tests/test_core.py::test_default_env_property jsonargparse_tests/test_core.py::test_default_env_override_true jsonargparse_tests/test_core.py::test_default_env_override_false jsonargparse_tests/test_core.py::test_env_prefix_true jsonargparse_tests/test_core.py::test_env_prefix_false jsonargparse_tests/test_core.py::test_env_properties_set_invalid jsonargparse_tests/test_core.py::test_parse_string_simple jsonargparse_tests/test_core.py::test_parse_string_simple_errors jsonargparse_tests/test_core.py::test_parse_string_nested jsonargparse_tests/test_core.py::test_parse_path_simple jsonargparse_tests/test_core.py::test_parse_path_simple_errors jsonargparse_tests/test_core.py::test_parse_path_defaults jsonargparse_tests/test_core.py::test_precedence_of_sources jsonargparse_tests/test_core.py::test_non_positional_required jsonargparse_tests/test_core.py::test_dump_complete jsonargparse_tests/test_core.py::test_dump_incomplete jsonargparse_tests/test_core.py::test_dump_formats jsonargparse_tests/test_core.py::test_dump_skip_default_simple jsonargparse_tests/test_core.py::test_dump_skip_default_nested jsonargparse_tests/test_core.py::test_dump_order jsonargparse_tests/test_core.py::test_parse_args_url_config jsonargparse_tests/test_core.py::test_save_multifile jsonargparse_tests/test_core.py::test_save_overwrite jsonargparse_tests/test_core.py::test_save_subconfig_overwrite jsonargparse_tests/test_core.py::test_save_invalid_format jsonargparse_tests/test_core.py::test_save_path_content jsonargparse_tests/test_core.py::test_print_config_normal jsonargparse_tests/test_core.py::test_print_config_skip_null jsonargparse_tests/test_core.py::test_print_config_invalid_flag jsonargparse_tests/test_core.py::test_default_config_files jsonargparse_tests/test_core.py::test_default_config_file_help_message_no_existing jsonargparse_tests/test_core.py::test_default_config_file_invalid_value jsonargparse_tests/test_core.py::test_default_config_files_pattern jsonargparse_tests/test_core.py::test_named_argument_groups jsonargparse_tests/test_core.py::test_set_get_defaults_single jsonargparse_tests/test_core.py::test_set_get_defaults_multiple jsonargparse_tests/test_core.py::test_add_multiple_config_arguments_error jsonargparse_tests/test_core.py::test_check_config_skip_none jsonargparse_tests/test_core.py::test_check_config_branch jsonargparse_tests/test_core.py::test_merge_config jsonargparse_tests/test_core.py::test_strip_unknown jsonargparse_tests/test_core.py::test_exit_on_error jsonargparse_tests/test_core.py::test_version_print jsonargparse_tests/test_core.py::test_debug_environment_variable jsonargparse_tests/test_core.py::test_parse_known_args_not_implemented jsonargparse_tests/test_core.py::test_parse_known_args_not_implemented_without_caller_module jsonargparse_tests/test_core.py::test_default_meta_property jsonargparse_tests/test_core.py::test_pickle_parser