'NoneType' object has no attribute 'initTag' : how can I solve this? - eyed3

I had an error:'NoneType' object has no attribute 'tag'
so I found it can be solved with running initTag.
but as I ran initTag, I got an error :
'NoneType' object has no attribute 'initTag'.
and there was no tag in the MP3 files.
Below are the code :
for i in range(len(namelist)):
path = "%s.mp3" % namelist[i]
tag = eyed3.load(path1)
tag.initTag()
tag.tag.artist = artistlist[i]
tag.tag.album = albumlist[i]
tag.tag.save()
how can I solve this?

Related

Maya 2023 pymel I can't access mel2py with python3

I get this error and I think it's because of python3
Error: AttributeError: file C:\Program Files\Autodesk\Maya2023\Python\lib\site-packages\pymel\tools\mel2py\melparse.py line 438: 'str' object has no attribute 'lineno'
import pymel.tools.mel2py as mel2py
pythonCode = mel2py.mel2pyStr( """
setDrivenKeyframe -currentDriver pCube1.translateY pCube2.translateX;
setDrivenKeyframe -currentDriver pCube1.translateY pCube2.translateY;
setDrivenKeyframe -currentDriver pCube1.translateY pCube2.translateZ;
""",pymelNamespace='pm')
print( pythonCode )
I believe the issue is down to how you're formatting the mel command string. If you use the code below it should function:
import pymel.tools.mel2py as mel2py
mel_command = 'setDrivenKeyframe "-currentDriver pCube1.translateY pCube2.translateX";setDrivenKeyframe "-currentDriver pCube1.translateY pCube2.translateY";setDrivenKeyframe "-currentDriver pCube1.translateY pCube2.translateZ";'
pythonCode = mel2py.mel2pyStr(mel_command, pymelNamespace='pm')
print(pythonCode)
A simple solution is to launch a maya2019 or maya2018 version prior to maya2022 and use mel2py there.

How to fix : "TypeError: 'StandardScaler' object is not iterable"?

I'm getting the error "TypeError: 'StandardScaler' object is not iterable".
The error happens in this part of my code:
gps = joblib.load('gps.zip')
accuracies, remain_features, models = joblib.load(os.path.join(bagging_dir, model_fname))
remain_features = [c for c in remain_features if c != 'index']
y_preds = []
scalers = joblib.load('scalers.zip')
gp, scaler, model = list(zip(gps,scalers, models))[0]
Specifically, this line:
gp, scaler, model = list(zip(gps,scalers, models))[0]
How do I fix this error? If you know, please tell me. Thank you so much!
I'm guessing that comes from this line:
remain_features = [c for c in remain_features if c != 'index']
I think you can't use a list comprehension on that, maybe try converting it into a list first?

Folium : type object 'Map' has no attribute 'FeatureGroup'

Getting
Output as error : AttributeError: type object 'Map' has no attribute 'FeatureGroup'
When I run this
can_map = folium.Map(location=[56.130, -106.35],zoom_start=4,tiles='Stamen Toner')
ontario = folium.Map.FeatureGroup()
ontario.add_child(folium.features.CircleMarker([51.25, -85.32],radius=5,color='red', fill_color='Red'))
can_map.add_child(ontario)
folium.marker([51.25, -85,32],popup='Ontario').add_to(can_map)
can_map
FeatureGroup is not an attribute of Map. Should be folium.FeatureGroup(...)
I made some other fixes that are noted in the comments
can_map = folium.Map(location=[56.130, -106.35],zoom_start=4,tiles='Stamen Toner')
# changed folium.Map.FeatureGroup() to folium.FeatureGroup()
ontario = folium.FeatureGroup()
# changed folium.features.CircleMarker to folium.CircleMarker
ontario.add_child(folium.CircleMarker([51.25, -85.32],radius=5,color='red', fill_color='Red'))
can_map.add_child(ontario)
# changed folium.marker to folium.Marker
# changed -85,32 to 85.32
folium.Marker([51.25, -85.32],popup='Ontario').add_to(can_map)
can_map

AttributeError: 'float' object has no attribute 'apply'

products['sentiment'] = products['rating'].apply(lambda rating : +1 if rating > 3 else -1)
It is showing the same error everytime:
AttributeError: 'float' object has no attribute 'apply'
I am using python 3.7, could you please help to resolve this ?
Looks like products['rating'] is a float; try this instead:
prodcuts['sentiment'] = 1 if products['rating'] > 3 else -1

AttributeError: 'str' object has no attribute 'localtime'

I usually have sandbox where I try snippets of code out.
When I run the following code in my sandbox it works as expected
tuple_current_time = time.localtime(time.time())
print("tuple_current_time = ", tuple_current_time)
But when I run it in the module I am developing I get the error
AttributeError: 'str' object has no attribute 'localtime'
if not (sched_time) == "TIME":
print("Its not equal", sched_time)
#print ("Variable Type : ", type (tuple_current_time))
#Create a tuple of current time
tuple_current_time = time.localtime(time.time())
print("tuple_current_time = ", tuple_current_time)
tuple_website = newtuple=(tuple_current_time[0], tuple_current_time[1], tuple_current_time[2], sched_hour, sched_min, 0, 0, 0, 0)
print("tuple_website = ", tuple_website)
if tuple_website > tuple_current_time:
#print("Website tuple is newer than current time tuple")
else:
#print("Current time tuple is newer than website time tuple")
Please can anybody advise what I am doing wrong?
Thanks

Resources