sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #03812
[Question #163869]: TypeError: 'list' object is not callable
New question #163869 on Sikuli:
https://answers.launchpad.net/sikuli/+question/163869
So I wrote this:
def find_orefolders(): # Finds all ore folders
ScanFolder = Region( ) # Sets area to search for folders
ScanFolder.findAll( )
orefolders = list(ScanFolder.getLastMatches())
#gets locations of all folders and orders them by y position
sorted_orefolders = sorted(orefolders, key=by_y)
return sorted_orefolders
#print (sorted_orefolders)
#print (len(sorted_orefolders))
def find_rocks(): # Finds all individual asteroids on screen
SelectRock = Region( )
try:
SelectRock.findAll( )
foundRocks = list(SelectRock.getLastMatches())
sorted_foundRocks = sorted(foundRocks, key=by_y)
return sorted_foundRocks
except: FindFailed
return 0
def folder_opener(): # This function opens the needed amount of folders
try:
rockCount = len(find_rocks())
except: TypeError
rockCount = 0
while rockCount < 6:
orefolders = find_orefolders()
for m in orefolders(): # <-------- this is line 93 <-------------------------------------
# Finds the region in which to check the arrow orientation
foundFolder = Region(m)
arrow = foundFolder.nearby(1)
arrow = arrow.left(19)
#arrow.highlight(5)
if arrow.exists( ,1): # If the arrow is closed it opens it and restarts the while loop
click(m)
orefolders = find_orefolders()
break
rockCount = len(find_rocks())
if rockCount >= 6:
break
folder_opener() # <------this is line 107
When i run it i get this error message:
[error] Stopped
[error] An error occurs at line 107
[error] Error message: Traceback (most recent call last):
File "C:\Users\Andrew\AppData\Local\Temp\sikuli-tmp8647247163812478721.py", line 107, in
folder_opener()
File "C:\Users\Andrew\AppData\Local\Temp\sikuli-tmp8647247163812478721.py", line 93, in folder_opener
for m in orefolders():
TypeError: 'list' object is not callable
I'm rather new with python and programming in general and i don't know how to get rid of this issue. I'm assuming it's something to do with the fact i'm getting the value from a function, since i wrote something almost identical to perform the same task, just without putting the code in functions. But the thing is supposed to check to see if an arrow by the folder is in a open or closed position.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.