Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

local variable 'target_table' referenced before assignment #156

Closed
mintar opened this issue Aug 23, 2017 · 1 comment
Closed

local variable 'target_table' referenced before assignment #156

mintar opened this issue Aug 23, 2017 · 1 comment

Comments

@mintar
Copy link

mintar commented Aug 23, 2017

When running xacro with an incorrectly set scope attribute, a local variable is referenced before assignment.

Steps to reproduce

minimal_example.urdf.xacro:

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
  <xacro:property name="math_pi" value="3.1415926535897931" scope="parent" />
</robot>
$ xacro --inorder minimal_example.urdf.xacro   
math_pi: no parent scope at global scope 
local variable 'target_table' referenced before assignment
UnboundLocalError("local variable 'target_table' referenced before assignment",)
when processing file: minimal_example.urdf.xacro

relevant lines

xacro/src/xacro/__init__.py

Lines 546 to 562 in b786d85

if scope and scope == 'global':
target_table = table.root()
unevaluated = False
elif scope and scope == 'parent':
if table.parent:
target_table = table.parent
else:
warning("%s: no parent scope at global scope " % name)
unevaluated = False
else:
target_table = table
unevaluated = True
if not unevaluated and isinstance(value, _basestr):
value = eval_text(value, table)
target_table._setitem(name, value, unevaluated=unevaluated)

rhaschke added a commit to ubi-agni/xacro that referenced this issue Aug 25, 2017
avoid access to undefined variable target_table
@rhaschke
Copy link
Contributor

@mintar Could you please close this issue if it is solved with #157.

@mintar mintar closed this as completed Nov 16, 2017
rhaschke added a commit to ubi-agni/xacro that referenced this issue Mar 27, 2018
avoid access to undefined variable target_table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants