Re: need help with a multiloop error
John Machin wrote: On Apr 23, 10:54 am, delc...@gmail.com wrote: Here is a little more of the code? Does this help at all? Not much. MRAB asked what is str2bool. Instead of answering the question, you have supplied some code which is calling str2bool (and doing interesting things if it fails). I can only assume that 's' is meant to be a string representing a Boolean value (eg "True"), but it's actually a float (or a float as a string, ie "0.0"?), so a TypeError is being raised, but the code is catching only ValueError. You talk about a "multiloop" as though it's a well-known concept ("running a Python program with a multiloop") ... it might be in industrial process automation but not in Python. *If* you believe that whether your program has a "multiloop" or not is relevant to the exception that you are getting, you had better explain what a "multiloop" is. I'd probably take it to mean a nested loop... Traceback (most recent call last): File "C:\Python25\commodity\commoditytrading4.2.py ", line 233, in That is a very interesting traceback output. How does the "http://"; get in there??? -- http://mail.python.org/mailman/listinfo/python-list
Re: need help with a multiloop error
On Apr 23, 10:54 am, delc...@gmail.com wrote: > Here is a little more of the code? Does this help at all? Not much. MRAB asked what is str2bool. Instead of answering the question, you have supplied some code which is calling str2bool (and doing interesting things if it fails). You talk about a "multiloop" as though it's a well-known concept ("running a Python program with a multiloop") ... it might be in industrial process automation but not in Python. *If* you believe that whether your program has a "multiloop" or not is relevant to the exception that you are getting, you had better explain what a "multiloop" is. > > > Traceback (most recent call last): > > > > File "C:\Python25\commodity\commoditytrading4.2.py > > commoditytrading4.2.py> ", line 233, in That is a very interesting traceback output. How does the "http://"; get in there??? -- http://mail.python.org/mailman/listinfo/python-list
Re: need help with a multiloop error
Here is a little more of the code? Does this help at all? try: b = str2bool(s) return b except ValueError, e: # s is not a boolean value, try eval(s): try: b = eval(s, globals, locals) return b except Exception, e: if debug: print On Apr 22, 10:30 am, MRAB wrote: > Brian wrote: > > I'm trying to run a python program with a multiloop and I am getting > > this error message. I was wondering if anyone could tell from this > > message what I'm doing wrong or where I've made a mistake. Let me > > know if you need some of the code for this to make more sense. Thanks > > a lot. > > > How much labor time does each individual have?8 > > 1331 > > Traceback (most recent call last): > > > File "C:\Python25\commodity\commoditytrading4.2.py > commoditytrading4.2.py> ", line 233, in > > > options = mp.options(all,names) > > File "C:\Python25\commodity\multipleloop.py", line 265, in options > > for name, value in zip(names, experiment)])) > > File "C:\Python25\commodity\misc.py", line 244, in str2obj > > b = str2bool(s) > > File "C:\Python25\commodity\misc.py", line 155, in str2bool > > (s, type(s)) > > TypeError: 0.0 cannot be converted to bool > > What is str2bool? Having the code would definitely help!- Hide quoted text - > > - Show quoted text - -- http://mail.python.org/mailman/listinfo/python-list
Re: need help with a multiloop error
On Wed, Apr 22, 2009 at 3:07 PM, Brian wrote: > I'm trying to run a python program with a multiloop and I am getting > this error message. I was wondering if anyone could tell from this > message what I'm doing wrong or where I've made a mistake. Let me > know if you need some of the code for this to make more sense. Thanks > a lot. > > > How much labor time does each individual have?8 > 1331 > Traceback (most recent call last): > > File "C:\Python25\commodity\commoditytrading4.2.py commoditytrading4.2.py> ", line 233, in > >options = mp.options(all,names) > File "C:\Python25\commodity\multipleloop.py", line 265, in options >for name, value in zip(names, experiment)])) > File "C:\Python25\commodity\misc.py", line 244, in str2obj >b = str2bool(s) > File "C:\Python25\commodity\misc.py", line 155, in str2bool >(s, type(s)) > TypeError: 0.0 cannot be converted to bool > -- > http://mail.python.org/mailman/listinfo/python-list > I think we'd have to see your str2* functions. I'm a bit confused as to why they exist anyhow, as the normal "if foo" tends to work in most situations. What are you trying to do? Why do you need str2obj, and str2bool? I'm betting that there's a much better way to solve what you're trying to, but we're going to need some more info (and code) to help. -- http://mail.python.org/mailman/listinfo/python-list
Re: need help with a multiloop error
Brian wrote: I'm trying to run a python program with a multiloop and I am getting this error message. I was wondering if anyone could tell from this message what I'm doing wrong or where I've made a mistake. Let me know if you need some of the code for this to make more sense. Thanks a lot. How much labor time does each individual have?8 1331 Traceback (most recent call last): File "C:\Python25\commodity\commoditytrading4.2.py ", line 233, in options = mp.options(all,names) File "C:\Python25\commodity\multipleloop.py", line 265, in options for name, value in zip(names, experiment)])) File "C:\Python25\commodity\misc.py", line 244, in str2obj b = str2bool(s) File "C:\Python25\commodity\misc.py", line 155, in str2bool (s, type(s)) TypeError: 0.0 cannot be converted to bool What is str2bool? Having the code would definitely help! -- http://mail.python.org/mailman/listinfo/python-list