**System Information**
Ubuntu 16.04, Intel HD Graphics 530
**Blender Version**
Broken: 2.78.c (from ppa)
Broken: 2.76 (from Ubuntu repos)
**Short description**
When Blender is launched from command line, with "--python" option (with ou without "--background" option), script is executed before UI is ready so ops like screenshot cannot be made while the same code works when running within Blender !
**Exact steps to reproduce the error**
**Working**:
1/ Start Blender (from shortcut, toolbar or Ubuntu dash)
2/ Load attached screenshot.blend (minimalistic file with python script embedded inside)
3/ Switch to "Scripting" screen layout
3/ Click "Run Script" : **Warning is emitted but screenshot is generated** and stored //in your $HOME directory// (since provided path is "." as second parameter of my own screenshot() call)
(didn't find the way to fix this last warning)
```
Traceback (most recent call last):
File "/usr/share/blender/2.78/scripts/startup/bl_ui/space_text.py", line 32, in draw
text = st.text
AttributeError: 'SpaceView3D' object has no attribute 'text'
location: /usr/share/blender/2.78/scripts/modules/bpy/ops.py:187
location: /usr/share/blender/2.78/scripts/modules/bpy/ops.py:187
```
**Working**:
1/ From your terminal, call
> $ blender screenshot.blend
(see blend file attached)
2/ Switch to "Scripting" screen layout
3/ Click "Run Script" : **same warning** is emitted but **screenshot is generated** and //stored in current directory//
**NOT working**:
1/ From your terminal, call
> $ blender --python screenshot.py
(see attached file, same code as the one embedded in the provided blend file)
2/ A screenshot is generated **containing an empty window filled with default color** (gray by default)
**NOT working**: (alternative with same result as previous one)
1/ From your terminal, call
> $ blender screenshot.blend --python screenshot.py
2/ A screenshot is generated containing an empty window filled with default color
**NOT working**:
1/ From your terminal, call "blender --background --python screenshot.py"
2/ **Crash, no screenshot generated**
(unable to find what is incorrect in the context, probably associated to the fact the UI is not ready when script is executed)
```
Traceback (most recent call last):
(...)
File "/usr/share/blender/2.78/scripts/modules/bpy/ops.py", line 187, in __call__
ret = op_call(self.idname_py(), C_dict, kw, C_exec, C_undo)
RuntimeError: Operator bpy.ops.screen.screenshot.poll() failed, context is incorrect
```
NOT working : (by the way)
If you uncomment the code trying to find a workaround playing with applications handlers (at bottom of provided file or inside Text editor), you'll find that load_pre or load_post are not raised when blender is called with a script from command line !
Thanks for your work. Blender is great, I'm trying to use it as an alternative to limited solution like OpenScad. I would like to be able to customize the UI to have a multiaxis view and make screenshots of the full window (or some areas depending on scenario) to "debug" 3D printed objects, being able (example) to "see" / check (step by step + different view angles) if the selected edge loop is the good one before extrusion and by "selection" I mean the edges highligthed (selected) before manipulation (so rendering and saving it is not a valid alternative). Not to mention the fact that fixing this bug can help a lot to automatize screen capture for tutorials !
{F654136} {F654137}