Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
my project error showing exit button? what can i do...i checked more times
def iExit():
iExit = tkinter.messagebox.askyesno("Customer Billing system","Confirm if you want to exit")
if iExit > 0:
root.destoy()
return
Error....
t__.py", line 2095, in __getattr__
return getattr(self.tk, attr)
AttributeError: '_tkinter.tkapp' object has no attribute 'destoy'
It is grammatical mistakes.check the spelling of destroy...
After if `iExit > 0:` check this `root.destroy()`
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 days ago.
Improve this question
class Solution:
def isPalindrome(self, x):
self.x=x
if x<=0:
print("false")
if x>0:
x==x[::-1]
return True
else:
return False
p=Solution()
p.x
I am getting an error:
AttributeError: 'Solution' object has no attribute 'x'
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
class Solution:
def remove(self,arr,target):
if target in arr:
arr.remove(target)
remove(arr,target)
return len(arr),arr
else:
return "not in the array"
ans=Solution()
print(ans.remove([3,2,2,3],3))
This is the Error
Traceback (most recent call last):
File "c:\Users\ashut\Practice\scrap.py", line 10, in <module>
print(ans.remove([3,2,2,3],3))
File "c:\Users\ashut\Practice\scrap.py", line 5, in remove
remove(arr,target)
NameError: name 'remove' is not defined
Somehow the above program runs in google colab and I've tried restarting the runtime
You have to add the "self" tag before calling the function inside ur function.
class Solution:
def remove(self,arr,target):
if target in arr:
arr.remove(target)
self.remove(arr,target)
return len(arr),arr
else:
return "not in the array"
ans=Solution()
print(ans.remove([3,2,2,3],3))
The temp variable name is arr, is that mean Array?
If so, the code "remove(arr, target)" is no need, remove this line, is OK.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
c = sqlite3.connect(history_db)
cursor = c.cursor
select_statement = "SELECT urls.urls,urls.Visit_count FROM urls,Visits WHERE
urls.id=visits.urls;"
cursor.execute(select_statement)
results = c.cursor.fetchcall()
print(results)
The code above when executed gives an error something like
Traceback (most recent call last):
File "test.py", line 13, in <module>
cursor.execute(select_statement)
AttributeError: 'builtin_function_or_method' object has no attribute
'execute'
I am new to using python sqlite3 so how do I execute this query with sqlite3 in python?
Connection.cursor is a method, if you don't call it you get the method object itself, not the result of calling it. IOW, what you want is
cursor = c.cursor()
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I am new to python and I get this error in my script below:
NameError: name 'csv_name_for' is not defined
def cvs_name_for(date):
return "abuse_{0}.csv".format(date)
def export_to_csv(complaints, date):
with open("{0}/{1}".format(CSV_DIR, csv_name_for(date)), "w") as csvfile:
# do stuff
What is wrong?
Your function name is cvs... and you call csv....
Fixed:
def csv_name_for(date):
return "abuse_{0}.csv".format(date)
def export_to_csv(complaints, date):
with open("{0}/{1}".format(CSV_DIR, csv_name_for(date)), "w") as csvfile:
# do stuff
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 years ago.
Improve this question
regardless of what the functions have to return, my code seems to not call the first function properly, as when I try to pass some doctest it raises the error:
File "preg3.py", line 27, in mesDivisions
if nombreDivisions(llista[0],m)>=nombreDivisions(llista[1],m):
NameError: global name 'nombreDivisions' is not defined
here is my code:
def nombreDivisons(n,m):
x=0
def aux(n,m):
if n<m:
return x
else:
if n%m==0:
x=x+1
return aux(n/m,m)
else:
return x
def mesDivisions(llista,m):
if len(llista)==1:
return llista[0],nombreDivisions(llista[0],m)
else:
if nombreDivisions(llista[0],m)>=nombreDivisions(llista[1],m):
del llista[1]
return mesDivisions(llista,m)
else:
del llista[0]
return mesDivisions(llista,m)
any ideas why?
Check your white space. You want at least one and according to pep8 two blank lines between functions.
You failure is a typo though. It should be nombreDivisions but you left out the i so it is nombreDivisons.