Python: using a specific date format in a logger Formatter crashes Blender on Windows #50021
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#50021
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I've started working with logging thanks to Sybrens presentation at BCon16. Today, I ran into a strange issue. On Linux, the code below works as expected, and gives me (what I think) nicely formatted log messages. However, on Windows, Blender (2.78a) closes immediately.
Now the strange part: If you remove the following part of the code below, the formatter works fine on Windows too:datefmt = '%D.%M.%Y, %H:%M:%S'
It seems like something in this formatting code causes a complete Blender shutdown, and only on Windows.
This is the full code, it can be run from a Blender Text Editor:
OS Windows 7, 64 bit, crashing
OS Ubuntu Gnome 16.04, working fine
Changed status to: 'Open'
Added subscriber: @RainerTrummer
Added subscriber: @mont29
Please try to reproduce this issue with vanilla python 3.6 for windows, this totaly sounds like python bug, not Blender bug…
Changed status from 'Open' to: 'Archived'
More than a week without reply. Due to the policy of the tracker archiving for until required info/data are provided.
Wasn't able to reply before as client projects kept me busy, sorry for the inconvenience.
Tried with Vanilla Python today, version 3.5.2, on the same machine where Blender crashes. Created both a file handler and stream handler for the logger, set the formatting as before, tried logging, all from interactive console. NO crash there.
Log output as desired:
Formatter used:
Changed status from 'Archived' to: 'Open'
Hmm… we are going to update to py3.5.2 in coming days, but so far Blender was released with py3.5.1, and 3.5.2 seems to include some datetime fixes. So can try to confirm issue is not reproducible with vanilla py3.5.1 under windows as well?
Added subscriber: @VukGardasevic
Can you also check if the Experimental VS 2015 builds from https://builder.blender.org/download/ crash for you?
@VukGardasevic I've tested a version which I compiled on the 23rd of November (reports as 2.78.4), it crashes, but with some more latency. Testing VS2015 build, downloaded right now: WORKS! no crashes there!
Added subscriber: @LazyDodo
I'm in the process of upgrading the windows libs, unless something unexpected causes issues the 3.5.2 libs should be available in the next few days.
@mont29 HEAD BUMP You can close the report I guess. For one, the crash doesn't appear in newer Python versions, but further more my date format was nonsense. The formatter should have been:
_formatter = logging.Formatter(fmt = '%(levelname)-8s | %(asctime)s | %(name)s.%(module)s, line %(lineno)d \n %(message)s\n', datefmt='%d.%m.%Y, %H:%M:%S')
In other words: Instead of:
datefmt='%D.%M.%Y, %H:%M:%S'
which I had passed on initially, it should read:
datefmt='%d.%m.%Y, %H:%M:%S'
I was passing the Minutes-Variable twice (%M is Minutes, not the Month), and the %D variable (which might be the var for the full date). Not sure why the crash didn't happen on Linux, but I think everything should be safe.
Changed status from 'Open' to: 'Archived'
Oki, then let’s consider this as settled for now (we can always reopen should the issue arise again with newest libs & builds). ;)
Updated libs to python 3.5.2 , issue remains on the vc2013 builds, the crash is coming out of the ms c runtime though, not sure what we could do about it, it's pretty much how wcsftime deals with a bad formatter, best advise is not to use a bad formatter.