Hi Gerald,
The code you are showing us is only a tiny fragment of the code actually running, and it is not enough for us to see what the error is.
sellDict and bs are not defined. EdtSlist is obviously a method, but a method of what?
The errors you are reporting do not seem to be possible from the method you are showing, so it looks like maybe there is more code involved.
You should start by reading these guides to how to provide a reproducible error:
otherwise we’re just guessing what is going on.
To start with, get rid of this wasteful and pointless try…except block:
try:
file1 = open(“Slist.txt”, “a”)
file1.write(“TEST”)
except:
print(“Unexpected error:”, sys.exc_info()[0])
raise
and any other “try…except:” blocks like it which may catch the exception and suppress the traceback. You, and we, need the traceback to effectively debug the code. I quote:
“You are throwing away the stack trace - a literally priceless body of information that can make the difference between troubleshooting a bug in days, or minutes. Yes, minutes.”
The traceback is the full block of error messages that starts with the word “Traceback” and ends with the final error message, showing all the lines of code involved in the error.
If you don’t see that traceback, you need to hunt down every except:
block and remove them with prejudice.
By the way, “Unexpected error” is a kick in the teeth to anyone who uses your software, even if that is only you. No kidding, of course it is an unexpected error, if it were expected you would have done something about it. Don’t tell me it is an unexpected error, tell me what the error is and where it happened – the full traceback – so I can fix it!