PyDBG Python 2.7 error: "TypeError: 'module' object is not callable"

1.3k views Asked by At

I am trying to use PyDBG with Python 2.7. I believe it is installed correctly.

import pydbg
dbg = pydbg()

Produces error when run:

Traceback (most recent call last):
File "[path removed..]\pydbg.py", line 1, in <module>
import pydbg
File "[path removed..]\pydbg.py", line 5, in <module>
dbg = pydbg()
TypeError: 'module' object is not callable
2

There are 2 answers

8
Óscar López On BEST ANSWER

Try this:

from pydbg import pydbg
dbg = pydbg()

In general, you should add the name of an imported module before calling any of its members:

import pydbg
dbg = pydbg.pydbg()

EDIT :

Also, make sure that the file that contains your script is not named pydbg.py, because it'd conflict with the name of the module you're trying to import. As it turns out, that was the problem.

6
Levon On

You probably have to do:

   dbg = pydbg.pydbg()

unless you specifically import pydbg from pydbg with

   from pydbg import pydbg

I prefer the former.