another problem with modules

Tim Hanson tjhanson at
Thu Feb 17 12:11:49 EST 2011

Okay, I solved my problem with Python finding modules:

I put the following into a file in my home directory, on the good advice of 
Andrea Crotti:

import sys

I named the file "~/", so now, in idle:

import pypath

No errors.

I'm still getting a little frustrated loading modules.  I typed the following 
little test function into idle:

def intersect(seq1,seq2):
  for x in seq1:
    if x in seq2:
  return res


No big deal.  Runs fine.  Exited and re-entered idle, 

import pypath
import intersect #the name of a file that contains the above short function.

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
TypeError: 'module' object is not callable

Huh?  Why doesn't this run when imported?  More importantly, how do I 
interpret this error message so that I can find the problem myself next time?

More information about the Python-list mailing list