By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,676 Members | 2,262 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,676 IT Pros & Developers. It's quick & easy.

Re: Class instantiation fails when passed in a file but work vialine by line interpreter

P: n/a
Jeff Tchang wrote:
Odd issue I am having with class instantiation on Python 2.5.2 (Windows).

I have a custom module with a few classes in it. The module is named
There is a copy of it in C:\Python25\Lib\site-packages\

Basically when I try to run a python file that tries to create an
instance of the class Subject I get this error:
AttributeError: type object 'SAML' has no attribute 'Subject'

In I have the class...

class Subject(object):

However, when I run the same line by line by starting up python it works.
>>import SAML
subject = SAML.Subject("Jo*****","EMailAddress")
print subject
<SAML.Subject object at 0x00C94770>
I've double checked I am loading the correct module by the usage of the -v flag.
What else should I be checking?
Look for assignments to "SAML" in your code, or a class definition of
something called SAML. That message should read "module object "SAML'
has no attribute 'Subject'". If SAML isn't a module, why not?

Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC

Nov 18 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.