Page MenuHome

Blend File Utils "SyntaxError: invalid syntax" when trying to Pack Blend to Archive
Closed, DuplicatePublic

Description

System Information
OS X 10.6.8
NVIDIA GeForce 320M

Blender Version
Broken: 2.77 22a2853

Short description of error
I tested out the new Blend File Utils add-on today and ran into a syntax error when I tried to use the "Pack Blend to Archive" feature.

The console shows this:

  File "/Applications/Blender 2.77/Blender 2.77.app/Contents/Resources/2.77/scripts/addons/io_blend_utils/blendfile_pack.py", line 272
    b".".join(f.rsplit(b".", 2)[0::2]): f for f_ in variations
                                            ^
SyntaxError: invalid syntax

Exact steps for others to reproduce the error

  1. Have open a scene with image textures (I am attaching the one I was using when I encountered the error.)
  2. Enable the Blend File Utils add-on.
  3. Choose File > External Data > Pack Blend to Archive

Details

Type
Bug

Event Timeline

Seth L. (quantumanomaly) set Type to Bug.
Seth L. (quantumanomaly) created this task.
Seth L. (quantumanomaly) raised the priority of this task from to Needs Triage by Developer.

I can't redo this bug, both in 2.77 release and in current master, using ArchLinux, (rBA872f12f7a76dd782e7f7b977047da4588e5d7f69).

Could someone else test this on OSX?

Cannot reproduce either here on linux… And even though this is a convoluted dict comprehension, I see nothing wrong with the syntax!

@Seth L. (quantumanomaly) what is your reported python version (either in console at blender startup, or by typing:

import sys
sys.version

…in Blender's py console)?

Sergey Sharybin (sergey) triaged this task as Confirmed, Medium priority.

It is totally reproduceable on OSX. Here's system info for those who wonders:

Just don't use confusing syntax ;)

@Bastien Montagne, my Python version is 2.6.1 (I guess I should probably update). Btw, it didn't work typing sys.version, but typing python -V in Terminal worked.

Hey, wanted to let you know that after updating to Python 3.5.1 it's working just fine! Case closed. :-)

This is caused by bpy.app.binary_path_python pointing to the wrong Python version.

Arg!!! no, not closed at all :P

I was asking to type those py commands in Blender's python console (one of its editors types), not in system terminal. ;)

Anyway, now I’m totally confused. 2.x python won’t work at all with Blender (simply won’t start), it absolutely needs 3.5. Thing is, this is supposed to be shipped with blender… And yet, @Sergey Sharybin (sergey) (which system-info.txt reports expected 3.5.1) can reproduce the bug, while you say installing external py 3.5.1 fixed it for you… Something is definitively wrong with OSX package/installation!

@Sergey Sharybin (sergey): that comprehension is totally valid and clear, the “chained” double for loop makes it a bit hard to read at first, that’s all. And afaik, it’s in py3 since the beginning (and even in 2.7 from https://www.python.org/dev/peps/pep-0274/ ) - but not 2.6…

In fact, I think I have an idea: can you please report what typing bpy.app.binary_path_python in blender py console reports to you? I have a feeling you’ll get OSX system python, and not Blender's one… ;)

meh, can ignore above comment now :P