Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 20755

[python] check for 'item not in mylist' causes TestComplete to crash

$
0
0
 

 

I am trying to build a list of backpointers. In there, I want to avoid duplicates. As far as i know i cant use a dict or set, because the items to be stored are not hashable. I implented the following code:

 

while k in range(limit):try:if path notin path_backp:
path_backp.append(path)continueelse:Log.Message(path.Item[k].Text)
path = path.Item[k].Items
limit = path.Count scan(path, path_backp, e,0)
k = k +1exceptAttributeError:
path = path_backp.pop()
limit = path.Count
k = k +1

 

the part to avoid double entities of course is:

 

if path notin path_backp:
path_backp.append(path)continueelse:[...]

 

Im running python inside TestComplete, which has (limited) debugging functions. When I enable the debugger and track what is happening, the first check works. The if-routine gets executed, and because path_backp is an empty dict, path gets appended, so that afterwards path_backp[0] equals path and I get back to to the while-routine. But when the if-routine gets executed the 2nd time (so when path_backp is no empty dict anymore), the debugger freezes for what seems an infinite amount of time.

same happens, by the way, when I implemented:

 

if path notin path_backp:
path_backp
.append(path)

 

without any continue or else.

Can anyone explain to me why this is happening and how I can handle the situation?

Many thanks,

 

t.


Viewing all articles
Browse latest Browse all 20755

Latest Images

Trending Articles



Latest Images