Bug: BVH import exception failure if bad input file #35358

Closed
opened 2013-05-14 23:06:45 +02:00 by CodeManX · 8 comments
Member

Project: Blender Extensions
Tracker: Py Scripts Release
Blender: 2.66
Python: 3.3
Script name: io_anim_bvh
Wiki page: http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/MotionCapture_BVH
Author(s): Campbell Barton
Category: Import Export
SVN Download: https://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts/addons/io_anim_bvh/
Status: Open

%%%If you try to import a bad file via console, the following exception error occurs:

Traceback (most recent call last):

File "<blender_console>", line 1, in <module>
File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\modules\bpy\ops.py", line 188, in __call__
  ret = op_call(self.idname_py(), None, kw)

RuntimeError: Error: Traceback (most recent call last):

File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_anim_bvh\__init__.py", line 149, in execute
  return import_bvh.load(self, context, **keywords)
File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_anim_bvh\import_bvh.py", line 622, in load
  global_scale=global_scale)
File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_anim_bvh\import_bvh.py", line 113, in read_bvh
  raise 'ERROR: This is not a BVH file'

TypeError: exceptions must derive from BaseException

location: C:\Program Files\Blender Foundation\Blender\2.67\scripts\modules\bpy\ops.py:188

In addition, the Wiki link doesn't exist:
http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/MotionCapture_BVH%%%

**Project**: Blender Extensions **Tracker**: Py Scripts Release **Blender**: 2.66 **Python**: 3.3 **Script name**: io_anim_bvh **Wiki page**: http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/MotionCapture_BVH **Author(s)**: Campbell Barton **Category**: Import Export **SVN Download**: https://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts/addons/io_anim_bvh/ **Status**: Open %%%If you try to import a bad file via console, the following exception error occurs: Traceback (most recent call last): ``` File "<blender_console>", line 1, in <module> File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\modules\bpy\ops.py", line 188, in __call__ ret = op_call(self.idname_py(), None, kw) ``` RuntimeError: Error: Traceback (most recent call last): ``` File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_anim_bvh\__init__.py", line 149, in execute return import_bvh.load(self, context, **keywords) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_anim_bvh\import_bvh.py", line 622, in load global_scale=global_scale) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_anim_bvh\import_bvh.py", line 113, in read_bvh raise 'ERROR: This is not a BVH file' ``` TypeError: exceptions must derive from BaseException location: C:\Program Files\Blender Foundation\Blender\2.67\scripts\modules\bpy\ops.py:188 In addition, the Wiki link doesn't exist: http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/MotionCapture_BVH%%%
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Campbell Barton was assigned by Brecht Van Lommel 2013-11-18 10:02:36 +01:00

Added subscriber: @brecht

Added subscriber: @brecht
Author
Member

Should be

raise Exception("Error: ...")

or maybe

raise ValueError("Error: ...")

Two more scripts with Py 2.x raise:

startup\bl_operators\uvcalc_lightmap.py
startup\bl_operators\uvcalc_smart_project.py

Should be ``` raise Exception("Error: ...") ``` or maybe ``` raise ValueError("Error: ...") ``` Two more scripts with Py 2.x raise: startup\bl_operators\uvcalc_lightmap.py startup\bl_operators\uvcalc_smart_project.py
Author
Member

Committed a patch to fix the TypeError, but it will now raise Exception(...) with info why the script fails (it won't continue).

Leaving this report open since there may be a better way to handle the exceptions in bvh importer.

The files
startup\bl_operators\uvcalc_lightmap.py
startup\bl_operators\uvcalc_smart_project.py
remained unchanged, since I don't have commit rights for that path.

Committed a patch to fix the TypeError, but it will now raise Exception(...) with info why the script fails (it won't continue). Leaving this report open since there may be a better way to handle the exceptions in bvh importer. The files startup\bl_operators\uvcalc_lightmap.py startup\bl_operators\uvcalc_smart_project.py remained unchanged, since I don't have commit rights for that path.
Author
Member

Patch to fix the TypeErrors, may require nice-ification too.
raise_exceptions.patch

Patch to fix the TypeErrors, may require nice-ification too. [raise_exceptions.patch](https://archive.blender.org/developer/F28795/raise_exceptions.patch)
Member

Added subscriber: @BrendonMurphy

Added subscriber: @BrendonMurphy
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Member

hi, closing as resolved, committed some time ago

hi, closing as resolved, committed some time ago
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#35358
No description provided.