bpy.ops.file.unpack_all() for packed entities without filename #43910

Closed
opened 2015-03-06 20:50:39 +01:00 by Janus · 9 comments

System Information
Applies to all operating systems

Blender Version
Broken: 2.73

Short description of error
If a packed image has an incorrect filename - for instance one that ends with a slash (like "//..............") - then unpacking fails with an exception.
If a packed image resource simply has no filename then it cannot unpack either. No error is thrown but a message is shown in the console and the file remains packed.

Exact steps for others to reproduce the error
The attached .blend contains an object with a packed texture. Press Alt+P (run script) in the text view to call unpack_all() or select unpack->write_local from the file menu.
The error message will show once the console is opened:

"Unable to copy file!
Copy from 'C:\ProgramData\BOINC\projects\burp.renderfarming.net\textures' to 'C:\ProgramData\BOINC\projects\burp.renderfarming.net\textures.001_' failed
Error: Error creating file 'C:\ProgramData\BOINC\projects\burp.renderfarming.net\textures'

Traceback (most recent call last):
File "C:\ProgramData\BOINC\projects\burp.renderfarming.net\invalid_unpack.blend\Text", line 2, in
File "C:\Users\BlenderBug\Testcases_Unpack\blender-2.73\2.73\scripts\modules\bpy\ops.py", line 189, in call
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Error: Error creating file 'C:\ProgramData\BOINC\projects\burp.renderfarming.net\textures'

Error: Python script fail, look in the console for now..."

Similarly for a resource with an empty filename:invalid_unpack.blend

ERROR: Image not available. Keeping packed image

Suggested behaviour
In the case where the resource is otherwise valid, an appropriate unique name can be generated for it upon unpacking it. For example a PNG image without (proper) filename could be unpacked as "F3N8SKA929_AUTOUNPACK.PNG".
This would allow external/internal tools to properly access the resource - for instance to render the .blend file with a renderer that can only load files from the filesystem and not directly from the packed .blend-file.

**System Information** Applies to all operating systems **Blender Version** Broken: 2.73 **Short description of error** If a packed image has an incorrect filename - for instance one that ends with a slash (like "//..\..\..\..\..\..\..\") - then unpacking fails with an exception. If a packed image resource simply has no filename then it cannot unpack either. No error is thrown but a message is shown in the console and the file remains packed. **Exact steps for others to reproduce the error** The attached .blend contains an object with a packed texture. Press Alt+P (run script) in the text view to call unpack_all() or select unpack->write_local from the file menu. The error message will show once the console is opened: > "Unable to copy file! > Copy from 'C:\ProgramData\BOINC\projects\burp.renderfarming.net\textures\' to 'C:\ProgramData\BOINC\projects\burp.renderfarming.net\textures\.001_' failed > Error: Error creating file 'C:\ProgramData\BOINC\projects\burp.renderfarming.net\textures\' > > Traceback (most recent call last): > File "C:\ProgramData\BOINC\projects\burp.renderfarming.net\invalid_unpack.blend\Text", line 2, in <module> > File "C:\Users\BlenderBug\Testcases_Unpack\blender-2.73\2.73\scripts\modules\bpy\ops.py", line 189, in __call__ > ret = op_call(self.idname_py(), None, kw) > RuntimeError: Error: Error creating file 'C:\ProgramData\BOINC\projects\burp.renderfarming.net\textures\' > > Error: Python script fail, look in the console for now..." Similarly for a resource with an empty filename:[invalid_unpack.blend](https://archive.blender.org/developer/F147580/invalid_unpack.blend) > ERROR: Image not available. Keeping packed image **Suggested behaviour** In the case where the resource is otherwise valid, an appropriate unique name can be generated for it upon unpacking it. For example a PNG image without (proper) filename could be unpacked as "F3N8SKA929_AUTOUNPACK.PNG". This would allow external/internal tools to properly access the resource - for instance to render the .blend file with a renderer that can only load files from the filesystem and not directly from the packed .blend-file.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @JanusBagerKristensen

Added subscriber: @JanusBagerKristensen
Author

The .blend-file link accidentally ended up somewhere in the middle of the bugreport and I can't edit it - here it is again:

invalid_unpack.blend

The .blend-file link accidentally ended up somewhere in the middle of the bugreport and I can't edit it - here it is again: [invalid_unpack.blend](https://archive.blender.org/developer/F147582/invalid_unpack.blend)
Bastien Montagne self-assigned this 2015-03-07 09:32:14 +01:00

Will tackle that.

Will tackle that.

This issue was referenced by 8dbbb60e8a

This issue was referenced by 8dbbb60e8a86d475016817213a8f26c951c22ae8

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit 8dbbb60e8a.

Closed by commit 8dbbb60e8a.

Added subscriber: @Harry-Kunz

Added subscriber: @Harry-Kunz

is it possible to loop through the unpacked files and rename them before unpacking? because unpacking files with names image.png.001, image.png.002, image.png.003, results in only 1 file overwriting all with final name image.png

is it possible to loop through the unpacked files and rename them before unpacking? because unpacking files with names image.png.001, image.png.002, image.png.003, results in only 1 file overwriting all with final name image.png
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
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
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#43910
No description provided.