read_factory_settings makes all other operators call fail in a python script ran at startup I want to read a ply mesh at blender startup using a python script given in the command line:
blender --python load_ply.py.
My script load_ply.py basically looks like this:
import bpy

# This line is the issue:
# bpy.ops.wm.read_factory_settings(use_empty=True) 

bpy.ops.import_mesh.ply(filepath='mesh.ply')

It works fine until I use bpy.ops.wm.read_factory_settings(use_empty=True) to clear the scene before the import, which gives the following error:
Python: Traceback (most recent call last):
  File &quot;/path/to/blender/blender-2.92.0-linux64/2.92/scripts/addons/io_mesh_ply/__init__.py&quot;, line 87, in execute
    context.window.cursor_set('WAIT')
AttributeError: 'NoneType' object has no attribute 'cursor_set'

location: /path/to/blender/blender-2.92.0-linux64/2.92/scripts/modules/bpy/ops.py:132
Error: Python: Traceback (most recent call last):
  File &quot;/path/to/blender/blender-2.92.0-linux64/2.92/scripts/addons/io_mesh_ply/__init__.py&quot;, line 87, in execute
    context.window.cursor_set('WAIT')
AttributeError: 'NoneType' object has no attribute 'cursor_set'

location: /path/to/blender/blender-2.92.0-linux64/2.92/scripts/modules/bpy/ops.py:132

Traceback (most recent call last):
  File &quot;/path/to/my/script/load_ply.py&quot;, line 5, in &lt;module&gt;
    bpy.ops.import_mesh.ply(filepath='mesh.ply')
  File &quot;/path/to/blender/blender-2.92.0-linux64/2.92/scripts/modules/bpy/ops.py&quot;, line 132, in __call__
    ret = _op_call(self.idname_py(), None, kw)
RuntimeError: Error: Python: Traceback (most recent call last):
  File &quot;/path/to/blender/blender-2.92.0-linux64/2.92/scripts/addons/io_mesh_ply/__init__.py&quot;, line 87, in execute
    context.window.cursor_set('WAIT')
AttributeError: 'NoneType' object has no attribute 'cursor_set'

location: /path/to/blender/blender-2.92.0-linux64/2.92/scripts/modules/bpy/ops.py:132

What is the meaning of this error?
What change does the read_factory_settings operator bring?
I use blender 2.92.0 on Debian 10.
A basic file mesh.ply:
ply
format ascii 1.0
element vertex 8
property float32 x
property float32 y
property float32 z
element face 6
property list uint8 int32 vertex_index
end_header
0 0 0
0 0 1
0 1 1
0 1 0
1 0 0
1 0 1
1 1 1
1 1 0
4 0 1 2 3
4 7 6 5 4
4 0 4 5 1
4 1 5 6 2
4 2 6 7 3
4 3 7 4 0
Separate into two scripts..
As commented by @scurest the read factory settings operator, naffs the contest, in this case context.window becoming None and throwing the error as shown.
Would either make a read_factory.py script
import bpy
bpy.ops.wm.read_factory_settings(use_empty=True) 

and with script as above (read factory settings commented out) (-P is equiv of --python)
blender -P read_factory.py -P load_ply.py

Opening a new file with just your imported ply mesh.  (Whereas starting with --factory-startup results in default startup objects and imported mesh)
For me the issue with doing this is my eyesight isn't what it used to be, and need everything a wee bit larger than default.
Another way would be to save an empty blank.blend  Could make your startup file blank.
blender -P load_ply.py blank.blend 

downside being if accidentally saved rather than save as is no longer blank.
Similar option is making a blank application template
New default file template?
(Note can add to your user config folder, eg on linux  ~/.config/blender/2.90/scripts/startup/bl_app_templates_user/blank/)
blender --app-template blank -P load_ply.py

other options commonly seen is removing or unlinking all collections / objects from scene / blend,
How to completely remove all loaded data from Blender?