Page MenuHome

Can't bundle blend file with image sequences
Open, Needs TriagePublic

Description

System Information
Windows 10

Short description of error
When a .blend file has an image sequence, attempting to bundle it will cause an AssertionError.

scanning deps: b'C:\\Users\\wisaa\\Desktop\\bam_absolute_path_bug.blend'...
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Program Files\Python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python36\lib\site-packages\bam\pack.py", line 10, in <module>
    blendfile_pack.main()
  File "C:\Program Files\Python36\lib\site-packages\bam\blend\blendfile_pack.py", line 667, in main
    filename_filter=exclusion_filter(args.exclude),
  File "C:\Program Files\Python36\lib\site-packages\bam\blend\blendfile_pack.py", line 220, in pack
    assert base_dir_src != base_dir_dst
AssertionError

The problem seems to come from these lines (421-424) in blendfile_pack.py:

for file_list in (
                    blendfile_path_walker.utils.find_sequence_paths(path_src) if fp.is_sequence else (),
                    fp.files_siblings(),
                    ):

blendfile_path_walker.utils.find_sequence_paths returns absolute paths instead of relative paths, so when os.path.join is used later on line 430 it has no effect.

Exact steps for others to reproduce the error
Unzip the attached .zip file, then try to pack the .blend file (python -m bam.pack --input <file path> --output <output file path> --mode FILE), because the file references an image sequence, it will fail with an AssertionError.

Details

Type
Bug

Related Objects

Event Timeline

This is a description of an error, but not any indication of what kind of behaviour would you expect. Please add that to the error description too.

Isaac Weaver (wisaac) renamed this task from Can bundle blend file with absolute paths to Can't bundle blend file with absolute paths.Jan 16 2018, 5:45 PM
Isaac Weaver (wisaac) updated the task description. (Show Details)

Convert those paths to relative paths and pack normally

I think this is a bad idea, as the choice between absolute and relative paths is one that is made conciously by the artist. For example, in the in the Blender Institute we have some assets on /shared/<project name>/.../<assetname>.abc, and those should remain absolute paths.

Blender can remap any absolute paths to relative for you, so there is no need for BAM to do this.

Keep the paths as absolute paths in the newly packed files (but don't throw an AssertionError)

This works fine for me:

% python -m bam.pack --input T53782-bam_absolute_path_bug.blend --output ~/tmp/bampack --mode FILE

scanning deps: b'/home/sybren/workspace/bam/blender-asset-manager/T53782-bam_absolute_path_bug.blend'...
  blend:       b'/home/sybren/workspace/bam/blender-asset-manager/T53782-bam_absolute_path_bug.blend'

archiving: 2 files
  source missing: b'/home/sybren/workspace/bam/Pictures/image.png'
  written: b'/home/sybren/tmp/bampack'

Weird, I'm on Windows and when I run:

python -m bam.pack --input bam_absolute_path_bug.blend --output output.blend --mode FILE

I get the following:

scanning deps: b'C:\\Users\\wisaa\\Desktop\\bam_absolute_path_bug.blend'...
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Program Files\Python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python36\lib\site-packages\bam\pack.py", line 10, in <module>
    blendfile_pack.main()
  File "C:\Program Files\Python36\lib\site-packages\bam\blend\blendfile_pack.py", line 667, in main
    filename_filter=exclusion_filter(args.exclude),
  File "C:\Program Files\Python36\lib\site-packages\bam\blend\blendfile_pack.py", line 220, in pack
    assert base_dir_src != base_dir_dst
AssertionError

The input and output should be in different directories. I know, the error message should be more clear, but that's the reason it's failing.

Isaac Weaver (wisaac) renamed this task from Can't bundle blend file with absolute paths to Can't bundle blend file with image sequences.Jan 21 2018, 12:57 AM
Isaac Weaver (wisaac) updated the task description. (Show Details)

Ok, so it seems that my attempt at recreating the original error was sidetracked by an identical error. I think I managed to figure out what caused the original issue.

Thanks for diving into this and providing a fix!