[Bf-committers] patch for 'object is not callable' exception in .obj importer
Campbell Barton
ideasman42 at gmail.com
Wed Dec 19 08:45:08 CET 2007
On Dec 19, 2007 6:46 AM, Mark Ivey <zovirl1 at sbcglobal.net> wrote:
> Greetings,
>
> I ran into a simple problem with the wavefront .obj importer. If the
> vertices are all integer values, it crashes with this error message:
>
> importing obj "/Users/mivey/crash.obj"
> passing obj file "/Users/mivey/crash.obj"...
> Traceback (most recent call last):
> File "<string>", line 831, in load_obj_ui
> File "<string>", line 594, in load_obj
> TypeError: 'NoneType' object is not callable
>
> The culprit is that get_float_func() can fall off the end of the
> function, implicitly returning None instead of a function reference.
> The fix is simple: make sure get_float_func returns float by
> default. I couldn't figure out how to add a patch to the tracker on
> projects.blender.org, but it is really simple so I'll include it here:
>
> Index: release/scripts/import_obj.py
> ===================================================================
> --- release/scripts/import_obj.py (revision 12940)
> +++ release/scripts/import_obj.py (working copy)
> @@ -542,6 +542,7 @@
> return lambda f: float(f.replace
> (',', '.'))
> elif '.' in line:
> return float
> + return float # Maybe file only contained integers? float is
> a good default.
>
> def load_obj(filepath, CLAMP_SIZE= 0.0, CREATE_FGONS= True,
> CREATE_SMOOTH_GROUPS= True, CREATE_EDGES= True, SPLIT_OBJECTS= True,
> SPLIT_GROUPS= True, SPLIT_MATERIALS= True, IMAGE_SEARCH=True):
> '''
>
> Here's a simple .obj file that exposes the problem:
> v 0 0 0
> v 0 0 1
> v 1 0 1
> v 1 0 0
> f 1 2 3 4
Good for picking up this one, commited the fix
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-committers/attachments/20071219/5ddafbd3/attachment.htm
More information about the Bf-committers
mailing list