Posts | ||
---|---|---|
Tricky Python Error | Locked | |
Thread Options | ||
Sep 25 2016 Anchor | ||
Hey, When I compile my module I'm getting a weird error that shouldn't exist since the code has never changed. Nevertheless, it can't process and output the correct .txt file because of it. Here's the error returned by cmd:
----------------------------------------------- These are the actual lines of code within the header_items.py def get_weight(y): This is a mod for Mount and Blade Warband. I have compared the affected files to a 'known working' set of files from a completely different mod for differences and have yet to notice ANY discrepancies between the two. I believe that the troops file won't process because of the hangup located in the *items files, but I could be wrong there too. Any thoughts or suggestions would be great. Thanks in advance. EDIT: does this have to do with my version of python? currently using 2.7.12 Edited by: Athen. |
||
Sep 25 2016 Anchor | ||
There's not enough information here to say anything worthwhile but the error is linked to "y" not being of int type but aggregate type. Thus somewhere get_weight() is called with a parameter that is not of int type. According to your output item[6] is not of int type which in turns means somwhere a non-int is assed to item array resulting in the problem. See if you can figure out where the item[6] is coming from. You can put a "print(y)" in the the function before the troublesome line to see what kind of value ended up in item[6] that should not. Can help find the source of the problem. |
||
Sep 26 2016 Anchor | ||
Hey Dragonlord, Thank you for responding. Wow, your're 100% correct. Upon printing (y) I get this: {'thrust': 522, 'size': 90, 'speed': 103, 'weight': 1.5, 'swing': 528} when it should look something more like this: 121013314768770040302927872 which, of course, is an int. I was able to trace the problem this way. Why debug when I can print! Sigh. Thank you again for looking into this. |
||
Sep 26 2016 Anchor | ||
print (or printf in C++) is your best friend to find problems. Forget debuggers... print for the win |
Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.