I’m using string extracts [startswith(“value”), “value” in, find(“value”)] in some of my arguments, and although the arguments work fine, when they’re not in operation the console returns “TypeError: iterable argument required”, that needless to say is annoying when I need to actually debug something. Anybody got a solution? Other than disabling the string extracts when trying to debug.
Make sure that they don’t run if they are not supposed to be in operation at some specified period.
Can’t think of a way to do that, they’re the requirment for the argument answer.
if n == "string name" or "alternate string name" in n: "insert argument answer here"
Is “in” a comparison operator? It’s usage is somewhat unfamiliar to me. Well anyway, try this:
if n == "string name" or n == "alternate string name": n = "insert argument answer here" # Is that what you want to do?
O, and be sure that n is set to something even if no strings are there to be evaluated. You can do that using “try: except:” statements.
So far as I can make out, ‘in’ works just the same way as ’ find’, only it looks cleaner, and uses less bytes.
No, sorry, I should have been clearer, I’m using it as an optionery condition to trigger an argument answer, or to put it a better way, I’ll extract an example.
if n == "OBmcp" or "OBmsc" in n: if s("plus").isPositive() and o.msv < 6 and o.tp > 0.1: o.msv += 1 o.tp = 0
Basically I’ve got several “OBmsc” objects, and I feel it’s better to extract a common name and use that as the optionery trigger, than use OBmsc, OBmsc.001, OBmsc.002 ectect.
Aye, in this argument I’ve got it set up with the except: n = 0. Only the raytrace isn’t the only place I’m using String Extracts.
Ohh, I see…what you’re doing that is. However I can’t seem to find the problem.
Hmm…What is o.msv? Take a better look at that, because the error has something to do with iteration, and that’s the only thing you iterate here from what I can see.
o.msv’s an integrater on the same object, I’ve checked out everything that’s using it, and it’ll all fine, and it works fine when used in this argument. I’ve taken all String Extracts out of the script for a second, and sure enough it’s them that’s causing the error.
I can only theorize there’s something wrong with the Blender python String Extraction code, all mine seems to work and check out fine.
I doubt that it’s a blender issue.
I think you’ll have to post the .blend after all.
I’ve managed to extract a section of the project causing the problem, I’d rather not upload the whole thing, partly because it’s huge, partly becuase it’s incomplete, and partly because some of the coding’s so bad it’s embarrassing ^^.
Edit: Odd, in this new file the error’s “Argument of type ‘int’ is not iterable”, however in the same line, with the same profile.
Edit2: Woops, using it on 2.44, that’s why the error name’s changed as opposed to the error on 2.42a
except: rn = “”
It has to be set to string. You can use a blank “” or “blah” or anything other then what you’re evaluating for. It has to be a string though.
Hmm? You’ve lost me. What argument needs to be excepted for?
In the .blend you posted. In the “list” script, line 23. Change except: rn = 0 to except: rn = “blah”
Oh! Heh, sorry, 0500 here. Yup, that’s the illusive bugger alright.
Thanks you muchly Social! Hopefully my last odd error for a while.
Glad I could help.