[FRPythoneers] New person's question

Mike Romberg romberg at fsl.noaa.gov
Thu Jul 18 12:03:02 MDT 2002


>>>>> " " == David Graham <dgraham at i3.com> writes:

     > OK: I am probably doing something stupid here.  But I can make
     > a class and run it from a script if the class and the script
     > are in the same file. But when I seporate the class into it's
     > own file, the file compiles ok, but I keep getting the
     > following error.

     > Traceback (most recent call last): File "./test_session.py",
     > line 16, in ?  session = igor_session() TypeError: object is
     > not callable: <module 'igor_session' from './igor_session.pyc'>

     > What am i missing when I seporate the two into seporate files?


  I'm just guessing here, since you have not provided any code as a
clue.  But I bet you've done something like this:

----------------- igor_session.py --------------

class igor_session:
    pass

----------------- test_session.py -----------------

import igor_session

igor_session()
--------------------------------------------------

  The reason this fails is that in test_session.py igor_session is a
module not a class.  You need to specify what you want out of the
igor_session module like this:

import igor_session

igor_session.igor_session() # call the ctor for the igor_session class
                            # in the igor_session module

Mike Romberg (romberg at fsl.noaa.gov)



More information about the FRPythoneers mailing list