New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FFI][Windows] Fix hasattr by extracting Python error type from Windows error message #4780
Conversation
Thanks @jonso4 ! |
@soiferj sorry, I'm late to the party. Getting over a flu. Anyways, I think there might be a problem. On my test, the " My issue is fixed if the body of
I'd attempt to fix, but I don't want to break the case you are dealing with. |
@jmorrill, I haven't seen an error formatted like that. Can you print out the full error string in the function that calls into this one? In all of my tests, the message begins with timestamp, which has a few ":" characters. If this does turn out to be an issue, I think we should handle both cases. If |
I added: print("line var is: ", line) This happens when I run autotvm, coming down the line from Here is the stack
Based on your suggestion, I threw this together, which seems to work with my use.
|
Oh interesting - your branch is throwing, while mine is just calling Update: you're going through a different codepath (AutoTVM). Let's update the logic as below. In any case, maybe we can update the logic. I think we can condense this:
into this:
What do you think? Would you be able to send a PR? |
Yes much cleaner, and works on my PC :) |
Co-authored-by: Jon Soifer <jonso@microsoft.com>
Co-authored-by: Jon Soifer <jonso@microsoft.com>
Co-authored-by: Jon Soifer <jonso@microsoft.com>
As discussed here,
hasattr
is currently broken for Windows. When aExpr
does not have an attribute, aTVMError
is thrown rather than anAttributeError
. This is because of how we extract the error type from the logged message.On Unix, DMLC will log the stack trace when
LOG(FATAL)
is called. However, DMLC will not log the stack trace on Windows. This causes the errors to look different.Unix:
Windows:
This change updates the error string parsing logic in
base.py
for Windows. It will use the generic format of this message to try to find the error type.@jmorrill @tqchen would you be able to take a look?