Hey, I have a wxpython frame object with a status bar. I can do self.SetStatusText() without any trouble, but when I do self.GetStatusText() I get this error:
Traceback (most recent call last):
File
"D:\python\code\test.pyw",
line 87, in <module>
frame = mainframe() File "D:\python\code\test.pyw",
line 40, in __init__
self.serverfield.SetValue(self.serverinfo())
File
"D:\python\code\test.pyw",
line 78, in serverinfo
status = self.GetStatusText(0) AttributeError: 'mainframe' object has
no attribute 'GetStatusText'
Because there is no such function. See the documentation. Try self.GetStatusBar().GetStatusText(), as defined here.
Related
I am trying to modify a model by adding variables/constraints and re-solving the updated model, following the guide.
The problem is that both cases fail with attribute errors, for a variable:
Traceback (most recent call last):
File "seqdesign.py", line 98, in <module>
main()
File "seqdesign.py", line 71, in main
problem._solver.add_var(problem._model.McBernoulliTrials)
File "/home/edo/miniconda3/envs/spacers/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/persistent_solver.py", line 153, in add_var
self._add_var(var)
File "/home/edo/miniconda3/envs/spacers/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/gurobi_direct.py", line 208, in _add_var
vtype = self._gurobi_vtype_from_var(var)
File "/home/edo/miniconda3/envs/spacers/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/gurobi_direct.py", line 377, in _gurobi_vtype_from_var
if var.is_binary():
AttributeError: 'IndexedVar' object has no attribute 'is_binary'
And for a constraint:
Traceback (most recent call last):
File "seqdesign.py", line 98, in <module>
main()
File "seqdesign.py", line 71, in main
problem._solver.add_constraint(problem._model.McBernoulliTrialsSetPositive)
File "/home/edo/miniconda3/envs/spacers/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/persistent_solver.py", line 132, in add_constraint
self._add_constraint(con)
File "/home/edo/miniconda3/envs/spacers/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/gurobi_direct.py", line 272, in _add_constraint
if is_fixed(con.body):
AttributeError: 'IndexedConstraint' object has no attribute 'body'
Is the problem that I am using indexed variables and constraints? How to make this work without migrating all code from pyomo.environ to pyomo.core?
You cannot pass an IndexedVar or and IndexedConstraint into the add_var and add_constraint methods. You have to loop over the individual variables and constraints and add them one at a time:
for v in my_var.values():
solver.add_var(v)
for c in my_con.values():
solver.add_constraint(c)
Additionally, you can check if a variable or constraint is indexed with my_var.is_indexed() or my_con.is_indexed().
when i tried to run this code, i got the "AttributeError" but idk why? please help me.
import os
import random
from moviepy.editor import *
List_image = os.listdir("müzik\kapaklar")
kapak_num = random.sample(range(1,len(List_image)+1),len(List_image))
List_songs = os.listdir("müzik\hazırlanacaklar")
for x in range(len(List_songs)):
songs = List_songs[x+1]
kapak = List_image[kapak_num[x+1]]
audio = AudioFileClip(songs) ### problem is here ###
image = ImageClip(kapak).set_duration(audio.duration)
video = image.set_audio(audio)
outfile = f"müzik\yapılanlar\%n_with_image.mp4",songs
video.write_videofile(outfile, fps=1)
error message:
C:\Users\erkan\Desktop\ChatCop\venv\Scripts\python.exe "C:/Users/erkan/Desktop/ChatCop/deus ex machina.py"
Traceback (most recent call last):
File "C:/Users/erkan/Desktop/ChatCop/deus ex machina.py", line 15, in <module>
audio = AudioFileClip(songs) # sıkıntı burada
File "C:\Users\erkan\Desktop\ChatCop\venv\lib\site-packages\moviepy\audio\io\AudioFileClip.py", line 72, in __init__
buffersize=buffersize)
File "C:\Users\erkan\Desktop\ChatCop\venv\lib\site-packages\moviepy\audio\io\readers.py", line 50, in __init__
infos = ffmpeg_parse_infos(filename)
File "C:\Users\erkan\Desktop\ChatCop\venv\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 276, in ffmpeg_parse_infos
"path.")%filename)
OSError: MoviePy error: the file 70s Japanese Jazz Mix (Rare Groove, Jazz-Funk, Hard Bop, Modal, Fusion, Breaks).mp3 could not be found!
Please check that you entered the correct path.
Exception ignored in: <bound method AudioFileClip.__del__ of <moviepy.audio.io.AudioFileClip.AudioFileClip object at 0x0000026210D45710>>
Traceback (most recent call last):
File "C:\Users\erkan\Desktop\ChatCop\venv\lib\site-packages\moviepy\audio\io\AudioFileClip.py", line 94, in __del__
self.close()
File "C:\Users\erkan\Desktop\ChatCop\venv\lib\site-packages\moviepy\audio\io\AudioFileClip.py", line 89, in close
if self.reader:
AttributeError: 'AudioFileClip' object has no attribute 'reader'
Process finished with exit code 1
I'm having a problem with deleting ADUser.
pyad.set_defaults(ldap_server="dc1.domain.com", username="service_account", password="mypassword")
user = aduser.ADUser.from_dn("cn=myuser, ou=staff, dc=domain, dc=com")
user.delete()
Unfortunately I could not figure out how to format this text to look like a real traceback
Traceback (most recent call last):
File "C:/Automation/qa/robot2/python_lib/keywords/AD/unittest.py", line 34,
in <module>
ad_connect.bg_ad_user_remove(user_login='vasya.oconnor#test-acme.com',dn_string= dn_string)
File "C:\Automation\qa\robot2\python_lib\keywords\AD\_bg_ad_general.py", line 156, in bg_ad_user_remove
user.delete()
File "C:\Python27\lib\site-packages\pyad\adobject.py", line 537, in delete
if not parent:
File "C:\Python27\lib\site-packages\future\types\newobject.py", line 90, in __nonzero__
return type(self).__len__(self)
AttributeError: type object 'ADContainer' has no attribute '__len__'
I ran a pywikibot sample code,
but it is aborted due to AttributeError.
Traceback is ...
Traceback (most recent call last):
File "pwb.py", line 270, in <module>
if not main():
File "pwb.py", line 264, in main
run_python_file(filename, [filename] + args, argvu, file_package)
File "pwb.py", line 109, in run_python_file
main_mod.__dict__)
File ".\cochonBot.py", line 81, in <module>
main()
File ".\cochonBot.py", line 52, in main
stub_list = cat_list_rec(u'遺꾨쪟:?좊쭑湲 遺꾨쪟', stub_ignore_cats)
File ".\cochonBot.py", line 14, in cat_list_rec
cat = catlib.Category(wikipedia.getSite(), top_cat)
AttributeError: 'module' object has no attribute 'getSite'
<type 'exceptions.AttributeError'>
CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
what is the replacement of wikipedia.getSite()? or is it still usable?
You can simply use pywikibot.Site() instead.
By using biopython library, I would like to add chains ids in my pdb file.
I'm using
p = PDBParser()
structure=p.get_structure('mypdb',mypdb.pdb)
model=structure[0]
model.child_list=["A","B"]
But I got this error:
Traceback (most recent call last):
File "../../principal_axis_v3.py", line 319, in <module>
main()
File "../../principal_axis_v3.py", line 310, in main
protA=read_PDB(struct,ch1,s1,e1)
File "../../principal_axis_v3.py", line 104, in read_PDB
chain=model[ch]
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/PDB/Entity.py", line 38, in __getitem__
return self.child_dict[id]
KeyError: 'A'
I tried to changes the keys in th child.dict, butI got another error:
Traceback (most recent call last):
File "../../principal_axis_v3.py", line 319, in <module>
main()
File "../../principal_axis_v3.py", line 310, in main
protA=read_PDB(struct,ch1,s1,e1)
File "../../principal_axis_v3.py", line 102, in read_PDB
model.child_dict.keys=["A","B"]
AttributeError: 'dict' object attribute 'keys' is read-only
How can I add chains ids ?
Your error is that child_list is not a list with chain IDs, but of Chain objects (Bio.PDB.Chain.Chain). You have to create Chain objects and then add them to the structure. A lame example:
from Bio.PDB.Chain import Chain
my_chain = Chain("C")
model.add(my_chain)
Now you can access the model child_dict:
>>> model.child_dict
{'A': <Chain id=A>, 'C': <Chain id=C>}
>>> model.child_dict["C"]
<Chain id=C>