Blenderkit: JSON file opened twice for writing #84778

Closed
opened 2021-01-16 14:01:19 +01:00 by Robert Guetzkow · 4 comments

Blender Version
Broken: version: 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: blender/blender@0f45cab862

Addon Information
Name: BlenderKit Online Asset Library (1, 0, 32)
Author: Vilem Duha, Petr Dlouhy

Short description of error
The function save_prefs contains the following code:

            f = open(fpath, 'w')
            with open(fpath, 'w') as s:
                json.dump(prefs, s)

The first open is redundant and leaves a file handle open that isn't closed.

Exact steps for others to reproduce the error

Take a look at the source code

**Blender Version** Broken: version: 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: `blender/blender@0f45cab862` **Addon Information** Name: BlenderKit Online Asset Library (1, 0, 32) Author: Vilem Duha, Petr Dlouhy **Short description of error** The function `save_prefs` contains the following code: ``` f = open(fpath, 'w') with open(fpath, 'w') as s: json.dump(prefs, s) ``` The first open is redundant and leaves a file handle open that isn't closed. **Exact steps for others to reproduce the error** # Take a look at the source code
Author
Member

Added subscriber: @rjg

Added subscriber: @rjg
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Vilem Duha self-assigned this 2021-01-18 12:23:48 +01:00

This issue was referenced by 835216ecad

This issue was referenced by 835216ecad59db3d626078221c1616803f165695
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#84778
No description provided.