Help needed in OOP-Python

Toufeeq Hussain toufeeqh at gmail.com
Wed Oct 5 03:44:26 EDT 2005


Fredrik,

sigh!
I see the problem you mention and I agree.
Should have posted the orginal code without edits. :(
Anyway I'll try to fill in whereever required.

On 10/5/05, Fredrik Lundh <fredrik at pythonware.com> wrote:
>
>
> $ python test.py
> condition satisfied
> Traceback (most recent call last):
> File "test.py", line 4, in ?
> Test_Case.Option1_constraint()
> File "module3.py", line 11, in Option1_constraint
> self.FOO_warning.Fire()
> AttributeError: Option1_Rule1 instance has no attribute 'FOO_warning'
>
> FOO_warning? there's no FOO_warning anywhere in the code.


FOO_warning is "Option1_warning" from Module3.

And, in Module1 comment out the line:
"common_subs.write_to_out_file( 'FOO_OUT',self.Warn_text)"

:::
>
> so, after four attempts, I've found four problems, three of which was
> present
> in your posted code, but I still haven't seen the problem you reported:
>
> Traceback (most recent call last):
> File "test_case.py", line 7, in ?
> TH = constraint.Option1_Rule1()
> File "constraint.py", line 13, in __init__
> declaration.Option1.__init__(self)
> TypeError: __init__() takes no arguments (1 given)


But the script when given as individual commands works fine in IDLE.
While executing the script it throws that error. :(

which, in itself, looks like you've forgotten the self argument in some init
> method somewhere (but the code you posted doesn't have that problem).


Yes,I've doubled checked this.

if you want to post code, 1) try to reduce the problem to as little code as
> you
> possibly can, and 2) make sure that the code you post really has the
> problem
> you're seeing... (i.e. run it at least once before you post it)


All points noted and will follow the same.
Thanks and my sincere apologies.

-toufeeq
--
Get Firefox:http://www.mozilla.org/products/firefox/
The fastest, safest and best Browser !!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20051005/1e06cee2/attachment.html>


More information about the Python-list mailing list