Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > another problem with modules

Thread Tools

another problem with modules

Tim Hanson
Posts: n/a
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?
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing v reloading modules modules Peter Peyman Puk Python 0 03-19-2010 05:09 PM
Disabling modules using Modules/Setup Ben Weintraub Python 0 09-09-2006 12:04 AM
Importing modules from within other modules Tobiah Python 2 09-14-2003 09:18 PM
imputils - import problem modules from sys.modules Remy Cool Python 1 08-27-2003 02:25 PM