no attribute in ifcopenshell - Python - python

I am facing this trouble
Like this picture,I don't know how to correct it
My Code is here:
import ifcopenshell
ifc_file = ifcopenshell.open(r'C:\Users\18640\Desktop\IFC+RVT\total model\小别墅.ifc')
product = ifc_file.by_type('IfcWall')[0]
for definition in product.IsDefinedBy:
property_definition = definition.RelatingPropertyDefinition
print(property_definition.Name)
for property in property_definition.HasProperties:
if property.is_a('IfcPropertySingleValue'):
print(property.Name)
print(property.NominalValue.wrappedValue)
result:
Traceback (most recent call last):
File "C:/Users/18640/Desktop/ifcopenshell/sample.py", line 6, in <module>
property_definition = definition.RelatingPropertyDefinition
File "C:\ProgramData\Anaconda3\lib\site-packages\ifcopenshell\entity_instance.py", line 68, in __getattr__
"entity instance of type '%s' has no attribute '%s'" % (self.wrapped_data.is_a(), name))
AttributeError: entity instance of type 'IfcRelDefinesByType' has no attribute 'RelatingPropertyDefinition'

Related

How can I fix this Qo-DL-Reborn error i tried reinstalling python and the error continues?

Traceback (most recent call last):
File "F:\GAMES-MOVIE-VIDEO-MUSIC COLLECTION [OPTICAL-DIGITAL]\DIGITAL COPIES\QOBUZ MUSIC\Qo-DL-Reborn\qo-dl_reborn.py", line 21, in
client = qopy.Client()
File "F:\GAMES-MOVIE-VIDEO-MUSIC COLLECTION [OPTICAL-DIGITAL]\DIGITAL COPIES\QOBUZ MUSIC\Qo-DL-Reborn\qopy\qopy.py", line 16, in init
self.id, self.sec = self.cfg_setup(False)
File "F:\GAMES-MOVIE-VIDEO-MUSIC COLLECTION [OPTICAL-DIGITAL]\DIGITAL COPIES\QOBUZ MUSIC\Qo-DL-Reborn\qopy\qopy.py", line 163, in cfg_setup
id = spoofer.get_app_id()
File "F:\GAMES-MOVIE-VIDEO-MUSIC COLLECTION [OPTICAL-DIGITAL]\DIGITAL COPIES\QOBUZ MUSIC\Qo-DL-Reborn\spoofbuz.py", line 20, in get_app_id
return re.search(self.appId_regex, self.bundle).group("app_id")
AttributeError: 'NoneType' object has no attribute 'group'

python: typecast object in dict()

I have the following code
histos = dict()
for key in list:
obj = file.Get(key)
if not key in histos:
histos[key] = obj.Clone()
else
histos[key].Add(obj)
Add() is a function of obj, however I get the following error if the object is retrieved from a python dict():
Traceback (most recent call last):
File "./script.py", line 35, in <module>
histos[key].Add(obj)
AttributeError: 'PyROOT_NoneType' object has no attribute 'Add'
How can I typecast objects retrieved from dict()

TypeError: 'float' object is not callable error while calling a function

This is the code I currently have:
def uniform_distribution(users,radius):
user_coordinates_distance=[]
user_coordinates=[]
finding_shadowing=[]
r=radius*np.sqrt(np.random.uniform(0,1,users))
angle=2*np.pi*np.random.uniform(0,1,users)
x = r*np.cos(angle)
y = r*np.sin(angle)
user_distance = np.sqrt(x*x+y*y)
x_shadowing=1000*x
y_shadowing=1000*y
x_shadowing=(x_shadowing-x_shadowing%10)/10
y_shadowing=(y_shadowing-y_shadowing%10)/10
finding_shadowing=shadowing(x_shadowing,y_shadowing,shadowing_matrix)
print(finding_shadowing)
for i in range (0,users):
user_coordinates=[x[i],y[i],user_distance[i],finding_shadowing[i]]
user_coordinates_distance.append(user_coordinates)
return (user_coordinates_distance)
And this is the error I get when I run it:
Traceback (most recent call last):
File "C:\Users\Ajit\Desktop\maryland\Sem 2\ENTS 656\project656\main program and functions\main_1.py", line 136, in <module>
user_coordinates=uniform_distribution(attempts,cell_radius)#list [x,y,distance,shadowing]
File "C:\Users\Ajit\Desktop\maryland\Sem 2\ENTS 656\project656\main program and functions\main_1.py", line 81, in uniform_distribution
finding_shadowing=shadowing(x_shadowing,y_shadowing,shadowing_matrix)
TypeError: 'float' object is not callable
What exactly does this error mean?

Deep-learning library Neon DataIterator / ArrayIterator init error

When trying to set up the DataIterator as explained on neon tutorial.
from neon.data import DataIterator
import numpy as np
X = np.random.rand(10000, 3072)
y = np.random.randint(1, 11, 10000)
train = DataIterator(X=X, y=y, nclass=10, lshape=(3, 32, 32))
I encountered a weird error:
ERROR:neon.data.dataiterator:DataIterator class has been deprecated and renamed"ArrayIterator" please use that name.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "neon/data/dataiterator.py", line 168, in __init__
super(DataIterator, self).__init__(*args, **kwargs)
File "neon/data/dataiterator.py", line 82, in __init__
self.Xdev = [self.be.array(x) for x in X]
AttributeError: 'NoneType' object has no attribute 'array'
I then tried with ArrayIterator, keeping X, y the same.
ArrayIterator(X=X, y=y, nclass=10, lshape=(3,32,32))
With the same NoneType error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "neon/data/dataiterator.py", line 82, in __init__
self.Xdev = [self.be.array(x) for x in X]
AttributeError: 'NoneType' object has no attribute 'array'
Why would this be the case? Is there an easy fix?
Fixed the problem by generating backend.
from neon.backends import gen_backend
be = gen_backend()
(...)

How to change/add chart data series in python-pptx?

I'm trying to set data in an existing chart using python-pptx.
from pptx import Presentation
pres_path = "C:\\pres.pptx"
pres = Presentation(pres_path)
pres.slides[3].shapes[4].chart.series[0].values
(92.0, 330.0, 309.0, 313.0, 356.0, 421.0, 457.0)
pres.slides[3].shapes[4].chart.series[0].values = (1,2,3)
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: can't set attribute
There's a method mentioned in the documentation which seems relevant, but I can't understand how to use it:
http://python-pptx.readthedocs.org/en/latest/_modules/pptx/chart/data.html
pres.slides[3].shapes[4].chart.replace_data((1,2,3))
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Python27\lib\site-packages\pptx\chart\chart.py", line 119, in replace_data
_SeriesRewriter.replace_series_data(self._chartSpace, chart_data)
File "C:\Python27\lib\site-packages\pptx\chart\chart.py", line 197, in replace_series_data
sers = cls._adjust_ser_count(chartSpace, len(chart_data.series))
AttributeError: 'tuple' object has no attribute 'series'
I'd appreciate any help you can provide.
Thanks!
To add a new series to an existing table behind a chart you need to do 3 things:
create an instance of ChartData()
provide category name
add the new series to the ChartData() object, using the "add_series()" func.
chart_data = ChartData()
chart_data.categories = 'category_name'
for col_idx, col in enumerate(single_df.columns):
chart_data.add_series(col, (single_df.ix[:, col_idx].values))
shp.chart.replace_data(chart_data)

Categories

Resources