It looks like your path
string when called from the handler is not a regular Python str
, but rather an instance of the QT class QString
. This appears to work for split
, but not for join
. I imagine you'll find the problem goes away if you convert it to a regular string with str
.
def find_config(self, path):
dic = list(str(path).split('/')) # added str() call to this line
print dic
size = len(dic)
print '/'.join(dic)
Note that your dic
variable has a rather misleading name. It's a list, not a dictionary, so calling it dic
is asking for confusion (though the list
call when it is created seems unnecessary). I'm also not sure what this function does. It seems to split a string, then rejoin it exactly as it was.