I am fairly new to Python and I am using VS Code on Linux. I have a function that reads a file in, and decodes some data. The function has two try: except: statements in it. The second set in the code is showing as unreachable and I cant figure out why. Can someone explain to me why this is happening?
def run(self):
self.connectPipe()
while True:
try:
ans = self.server.readFile(self.tid,self.fid, 0, 1024)
except Exception, e:
pass
else:
try:
global LastDataSent
if ans != LastDataSent:
sys.stdout.write(ans)
sys.stdout.flush()
else:
# Don't echo what I sent, and clear it up
LastDataSent = ''
# Just in case this got out of sync, i'm cleaning it up if there are more than 10 chars,
# it will give false positives tho.. we should find a better way to handle this.
if LastDataSent > 10:
LastDataSent = ''
except:
pass