Dump Scene object Information To console or String for debugging purposes
I had the need to do something similar recently, and here is a very brief solution that I attempted, hopefully it can be helpful:


Create a script at the same location with your target .blend file named something like script.py:


import bpy
# Use bpy.context.scene.objects.keys() to get the name of objects

with open('output.txt', 'w+') as the_file:
    the_file.write(', '.join(bpy.context.scene.objects.keys()))



Execute blender in background for the target file and run the script: In command line, use blender -b filename.blend -P script.py to run blender in background and execute the script on the scene.


This script will dump all object names in the scene into a file named "output.txt".