eval() woes

Simon Forman rogue_pedro at yahoo.com
Tue Aug 29 00:57:46 EDT 2006


rdrink wrote:
> Hey Simon, Thanks for the reply.
>
> Simon Forman wrote:
> > You must be doing something weird,  that equation works for me:
> > Try posting the minimal code example that causes the error and the
> > full, exact traceback that you get.
>
> I appreciate the offer... but at this point my code is too recursive
> and deeply nested to send a "simple" example

That's not an offer, it's a request.  There's not enough information in
your original post to know what you're doing, let alone what you're
doing wrong.

If you explain for fully what's actually going on (i.e. tracebacks and
code) then it's much more likely that I or someone else on this list
will be able to help you figure out what's wrong.

>
> > (Also, assuming your equations are already strings, there's no reason
> > to call str() on them again.
>
> This is an interesting point: I AM putting them into the file as
> strings, and then pulling them back out as such and you are right, they
> do not need to be re-cast as strings. I think as some point I was
> getting errors there, but for now I can omit that....
>
> > And you mention a "dictionary level" but
> > don't mention using a dict.)
>
> Sorry, that was a spurious thought... No I'm not using a dict (although
> I am still not sure if I should be)...
>
> > FWIW, the error "ValueError: invalid literal for int()" occurs when
> > you, uh, pass an invalid literal to the int() function (actually int
> > type.. but not important here), and includes the invalid input so you
> > don't have to guess at it:
> >
> > |>> int('wombat')
> > HTH
>
> Yes that is helpful.
> I am still getting errors... which leads me to belive that it all has
> to do with how I am casting, and re-casting, things as strings and
> ints.
> I need a little more time to try to suss this all out; after which, if
> I still can't get it to work, I'll post some more code.
> 
> Thanks again for your thoughts and comments.
> 
> Robb




More information about the Python-list mailing list