object_attributes on a BDF object

8 views
Skip to first unread message

Paul Blelloch

unread,
Jan 2, 2016, 7:12:32 PM1/2/16
to pyNastran Discuss
I'm running the current master branch on GitHub (0.8.0+dev.74b7155)

When I go through the BDF demo that I found at http://pynastran-git.readthedocs.org/en/latest/manual/bdf_doc.html, I find that the object_attributes method works on objects inside the BDF object (such as elements or nodes), but gives the following error when I try to run it on a BDF object (as in the demo):

<code object __object_attr at 0x00000147A8687810, file "c:\users\test\documents\github\pynastran\pyNastran\utils\__init__.py", line 103>
<code object object_attributes at 0x00000147A8687A50, file "c:\users\test\documents\github\pynastran\pyNastran\utils\__init__.py", line 158>
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-58-b1fa7bde9488> in <module>()
----> 1 object_attributes(isat)

c:\users\test\documents\github\pynastran\pyNastran\utils\__init__.py in object_attributes(obj, mode, keys_to_skip)
    178         if the mode is wrong
    179     """
--> 180     return __object_attr(obj, mode, keys_to_skip, lambda x: not isinstance(x, MethodType))
    181 
    182 

c:\users\test\documents\github\pynastran\pyNastran\utils\__init__.py in __object_attr(obj, mode, keys_to_skip, attr_type)
    121         # if k in keys_to_skip:
    122             # continue
--> 123         if check(k) and attr_type(getattr(obj, k)):
    124             out.append(k)
    125     out.sort()

c:\users\test\documents\github\pynastran\pyNastran\bdf\bdfInterface\attributes.py in convectionProperties(self)
    755     @property
    756     def convectionProperties(self):
--> 757         self.deprecated('convectionProperties', 'convection_properties', '0.8')
    758         return self.convection_properties
    759 

c:\users\test\documents\github\pynastran\pyNastran\bdf\bdfInterface\attributes.py in deprecated(self, old_name, new_name, deprecated_version)
     70     def deprecated(self, old_name, new_name, deprecated_version):
     71         """deprecates methods"""
---> 72         return deprecated(old_name, new_name, deprecated_version, levels=[0, 1, 2])
     73 
     74     def __init_attributes(self):

c:\users\test\documents\github\pynastran\pyNastran\bdf\utils.py in deprecated(old_name, new_name, deprecated_version, levels)
    804         line_no = frame.f_lineno
    805         code = frame.f_code
--> 806         filename = os.path.basename(frame.f_globals['__file__'])
    807         print(code)
    808         source_lines, line_no0 = inspect.getsourcelines(code)

KeyError: '__file__'

Steven Doyle

unread,
Jan 3, 2016, 3:50:05 PM1/3/16
to pyNastran Discuss
Hi Paul,

Apparently iPython doesn't have a __file__ data member, which is a bit weird, so when the deprecation warning hit it crashed.  I've fixed it so that won't crash the demo anymore and removed all deprecated code from the demo.

Steve

--
You received this message because you are subscribed to the Google Groups "pyNastran Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynastran-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages