6

I have no idea, if this is a IronPython issue, a Revit API assembly issue, or something else. Any information/ideas on what could be causing this is appreciated.

I understand this is solvable by re-importing the same namespace again, but I am dying to understand why that is.

Below is short example of what is happening. Images show RevitPythonShell Console output.

File1.py

import clr
clr.AddReference('RevitAPI')      # Contains Imports Autodesk.Revit.DB
from Autodesk.Revit import DB     # OK
DB.Element.Name                   # OK
DB.Element.Name.GetValue()        # OK: Method exists. As Expected

File2.py

from File1 import DB
DB.Element.Name                   # OK, Property Exists
DB.Element.Name.GetValue()        # *** Method DOES NOT Exist, Attribute Error is raised
from Autodesk.Revit import DB     # Re-import the same namespace again
DB.Element.Name.GetValue()        # OK:  Method Exists 

enter image description here

enter image description here

gtalarico
  • 4,409
  • 1
  • 20
  • 42
  • can you quickly check the line `from File2 import DB` in the file `File2.py`? That could be your problem right there... but also could just be you typing it wrong into SO... – Daren Thomas Nov 14 '16 at 08:22
  • Thanks Daren. Apologies, that was just a typo in the example. The file1 is being imported properly. – gtalarico Nov 14 '16 at 10:34
  • OK. I can reproduce this. It is really very interesting. I too have no idea what is going on here... – Daren Thomas Nov 15 '16 at 14:44
  • Filed as a bug, I will post back if I get an answer from the maintainers: https://github.com/IronLanguages/main/issues/1540 – gtalarico Nov 20 '16 at 01:46
  • 1
    New issue url: https://github.com/IronLanguages/ironpython2/issues/79#issuecomment-313970079 – gtalarico Sep 20 '17 at 16:31

0 Answers0