AttributeError in script

Hi, everyone.
An error occurred while running the script.
What could be the mistake?

file:///C:/Users/kozlovskiy/AppData/Local/Temp/%D0%91%D0%B8%D0%B1%D0%B8%D0%BE%D1%82%D0%B5%D0%BA%D0%B0%20%D1%8D%D0%BB%D0%B5%D0%BC%D0%B5%D0%BD%D1%82%D0%BE%D0%B2.html

IronPython Traceback:
Traceback (most recent call last):
File “C:\Users\kozlovskiy_Проекты\Revit\Плагины\Плагин\Documents\Спектрум АК\Спектрум АК.extension\Спектрум АК.tab\Схема.panel\Бибиотека элементов.pushbutton\script.py”, line 6, in
AttributeError: ‘module’ object has no attribute ‘get_bindle_file’

a typo @ line 6 of your script.py file.
it should be: get_bundle_file

there was a new error.
IronPython Traceback:
Traceback (most recent call last):
File “C:\Users\kozlovskiy_Проекты\Revit\Плагины\Плагин\Documents\Спектрум АК\Спектрум АК.extension\Спектрум АК.tab\Схема.panel\Бибиотека элементов.pushbutton\script.py”, line 16, in
NameError: name ‘MyWindow’ is not defined

hard to tell, without the code…
whenever you post a question, make sure to include some background such as the code itself, the file, or screen captures.

I followed the example of GUI Basics: First “Hello World” WPF Window
link https://www.youtube.com/watch?v=fampgK0W7Nw&t=2504s
the code itself:
import clr
clr.AddReference(‘System.Windows.Forms’)
clr.AddReference(‘IronPython.wpf’)
from pyrevit import script
xamlfile = script.get_bundle_file(‘ui.xaml’)
import wpf
from System import Windows
class MyWndow(Windows.Window):
def init(self):
wpf.LoadComponent(self, xamlfile)
MyWindow().ShowDialog()Preformatted text

again. :slight_smile: typo
class MyWindow(Windows.Window):

I apologize for children’s mistakes. it’s my own fault. the window has started.

1 Like

That happens.

best advice: always read and try to understand the error message you recieve

Cheers @andrey_mos

1 Like

advise me, how to look at the category of families and how to contact them? the example referred to the wall category
“” “Calculates total volume of all walls in the model.” “”
from Autodesk.Revit import DB
doc = __revit __. ActiveUIDocument.Document
"Creating collector instance and collecting all the walls from the model
wall_collector = DB.FilteredElementCollector (doc)
.OfCategory (DB.BuiltInCategory.OST_Walls)
.WhereElementIsNotElementType ()
" Iterate over wall and collect Volume data
total_volume = 0.0
for wall in wall_collector:
vol_param = wall.Parameter [DB.BuiltInParameter.HOST_VOLUME_COMPUTED]
if vol_param:
total_volume = total_volume + vol_param.AsDouble ()
" now that results are collected, print the total
print (“Total Volume is: {}”. format (total_volume))

how can solve the problem?
image

@andrey_mos
Please make another post.

  • It is easier for others to get answers to the same issue for other users.
  • It is easier to grab interest.

Also, include your code
with the screen capture.
And give us some context, like you are using it in Revit in Russian for example. It looks like an encoding issue.