instantiating a class

Bengt Richter bokr at oz.net
Sat Mar 9 00:55:38 EST 2002


On Fri, 8 Mar 2002 23:23:08 -0600, "Carl" <kingprad at mail.com> wrote:

>I'm an intermediate-level python programmer and use classes all the time,
>but a weird problem is frustrating me.
>
>In my main program:
>
>
>import lj_connect
>
>blah blah code
>
>talkserver = lj_connect.lj_connect(userinfo)
>
>
what happens if you go to the directory where lj_connect.py is,
run python, and do the above (minus blah blah ..) interactively?

if the import succeeds, try dir(lj_connect) to see whether the
spelling of the class name might have gotten glitched, or whatever.

>the start of lj_connect.py is this:
>
>class lj_connect:
> def __init__(self,basic_data):
>  self.uinfo = basic_data
>
>
>I'm getting an AttributeError saying module lj_connect has no attribute
>lj_connect. Originally the lj_connect code was in the same file as the main
>program until I moved it for readability's sake. Can anyone see a problem?
>Thank so much!

Looks like it ought to work. Did you accidentally include class lj_connect
in a """comment""" ? The dir(lj_connect) will tell.

Regards,
Bengt Richter

>
>Carl
>
>




More information about the Python-list mailing list