need help with a multiloop error

B

Brian

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 <http://
commoditytrading4.2.py> ", line 233, in <module>

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 <type 'float'> cannot be converted to bool
 
M

MRAB

Brian said:
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 <http://
commoditytrading4.2.py> ", line 233, in <module>

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 <type 'float'> cannot be converted to bool
What is str2bool? Having the code would definitely help!
 
D

delco27

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



Brian said:
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 <http://
commoditytrading4.2.py> ", line 233, in <module>
    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 <type 'float'> cannot be converted to bool

What is str2bool? Having the code would definitely help!- Hide quoted text -

- Show quoted text -
 
J

John Machin

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.

That is a very interesting traceback output. How does the "http://"
get in there???
 
M

MRAB

John said:
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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top