ljcooke / see

Python's dir() for humans.
https://ljcooke.github.io/see/
BSD 3-Clause "New" or "Revised" License
245 stars 18 forks source link

OS X: TypeError: 'module' object is not callable #12

Closed hugovk closed 8 years ago

hugovk commented 8 years ago

Following the readme:

$ pip install --upgrade see
Collecting see
Installing collected packages: see
Successfully installed see-1.2.0

$ python
Python 2.7.10 (default, Sep 23 2015, 04:34:21) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from see import see
>>> foo = 'bar'
>>> see()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable
hugovk commented 8 years ago

I get the same for all the pip installable versions, back to 0.4.0.

hugovk commented 8 years ago

Back to latest 1.2.0, this works:

Python 2.7.10 (default, Sep 23 2015, 04:34:21) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from see import see
>>> dir(see)
['PY_300', 'PY_301', 'PY_350', 'SYMBOLS', 'SeeError', '_LOCALS', '_SeeDefault', '_SeeOutput', '__all__', '__author__', '__builtins__', '__contributors__', '__copyright__', '__doc__', '__file__', '__license__', '__name__', '__package__', '__version__', 'fcntl', 'fn_filter', 'fnmatch', 'inspect', 'line_width', 're', 'regex_filter', 'see', 'struct', 'sys', 'term_width', 'termios', 'textwrap']
>>> foo = 'bar'
>>> see()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable
>>> see.see()
    foo    see
>>> 
ljcooke commented 8 years ago

It might be importing a leftover .pyc file, or some other file in the working directory.

Is there a see subdirectory where you're running it? Does it work if you cd /tmp and try again?

hugovk commented 8 years ago

Thanks, got it working!

Well, as it happens there was a leftover see directory in /tmp, but I get the same thing after getting rid of it. So I did:

$ pip uninstall see
Uninstalling see-1.2.0:
  /usr/local/lib/python2.7/site-packages/see-1.2.0.dist-info/DESCRIPTION.rst
  /usr/local/lib/python2.7/site-packages/see-1.2.0.dist-info/INSTALLER
  /usr/local/lib/python2.7/site-packages/see-1.2.0.dist-info/METADATA
  /usr/local/lib/python2.7/site-packages/see-1.2.0.dist-info/RECORD
  /usr/local/lib/python2.7/site-packages/see-1.2.0.dist-info/WHEEL
  /usr/local/lib/python2.7/site-packages/see-1.2.0.dist-info/metadata.json
  /usr/local/lib/python2.7/site-packages/see-1.2.0.dist-info/top_level.txt
  /usr/local/lib/python2.7/site-packages/see.py
  /usr/local/lib/python2.7/site-packages/see.pyc
Proceed (y/n)? y
  Successfully uninstalled see-1.2.0
$ pip uninstall see
Cannot uninstall requirement see, not installed
$ cd /usr/local/lib/python2.7/site-packages/
$ ls see/
__init__.py __init__.pyc    see.py      see.pyc

So there was some old installation stuff there, despite what pip said. So I got rid of that dir and reinstalled and it works.

Thanks for pointing me in the right direction!