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

NameError: global name 'namespace' is not defined in prop_helpers.py line 256 #56

Open
nimartet opened this issue Mar 22, 2023 · 1 comment

Comments

@nimartet
Copy link

nimartet commented Mar 22, 2023

When using Redhawk 2.10 + the solution described in issue 55, launching a component in the python sandbox sometimes results in the following error:

bash-4.2# python -i VocoderFileCapture.py 
/usr/bin/python 2.7.5 (default, Jun 28 2022, 15:30:04) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
Traceback (most recent call last):
  File "VocoderFileCapture.py", line 9, in <module>
    sb.launch("spx.VocoderService")
  File "/usr/local/redhawk/core/lib/python/ossie/utils/sb/domainless.py", line 1358, in launch
    objType=objType, shared=shared, stdout=stdout)
  File "/usr/local/redhawk/core/lib/python/ossie/utils/sandbox/base.py", line 260, in launch
    comp = clazz(self, profile, spd, scd, prf, instanceName, refid, impl)
  File "/usr/local/redhawk/core/lib/python/ossie/utils/sandbox/model.py", line 183, in __init__
    SandboxResource.__init__(self, *args, **kwargs)
  File "/usr/local/redhawk/core/lib/python/ossie/utils/sandbox/model.py", line 54, in __init__
    ComponentBase.__init__(self, spd, scd, prf, instanceName, refid, impl)
  File "/usr/local/redhawk/core/lib/python/ossie/utils/model/__init__.py", line 1417, in __init__
    super(ComponentBase, self).__init__(prf, refid)
  File "/usr/local/redhawk/core/lib/python/ossie/utils/model/__init__.py", line 1088, in __init__
    includeNil=True)
  File "/usr/local/redhawk/core/lib/python/ossie/utils/model/__init__.py", line 1209, in _getPropertySet
    p.clean_name = _prop_helpers.addCleanName(id_clean, prop.get_id(), _displayNames, _duplicateNames)
  File "/usr/local/redhawk/core/lib/python/ossie/utils/prop_helpers.py", line 256, in addCleanName
    count = _duplicateNames[cleanName][namespace] + 1
NameError: global name 'namespace' is not defined

This does not occur for all components. For example, I can launch other components not provided by redhawk successfully.
After some investigation, I found what appears to be a discrepancy in variable names being used in $OSSIEHOME/lib/python/ossie/utils/prop_helpers.py in the addCleanName function (namespace vs namesp). After correcting the discrepancy, I as able to launch the component.

The following diff is now used as a patch file when building our redhawk container:

bash-4.2# diff -Naur prop_helpers.py.orig prop_helpers.py
--- prop_helpers.py.orig	2023-03-22 14:05:49.154086762 +0000
+++ prop_helpers.py	2023-03-22 14:07:14.350943467 +0000
@@ -253,9 +253,9 @@
         return retval
     elif _displayNames[cleanName] != id:
         if namesp in _duplicateNames[cleanName]:
-            count = _duplicateNames[cleanName][namespace] + 1
+            count = _duplicateNames[cleanName][namesp] + 1
             _displayNames[cleanName + str(count)] = id
-            _duplicateNames[cleanName][namespace] = count
+            _duplicateNames[cleanName][namesp] = count
             retval=cleanName + str(count)
         else:
             _duplicateNames[cleanName][namesp] = 0
@nimartet
Copy link
Author

prop_helpers.patch

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

1 participant