Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an error trying to run #26

Closed
rpoole opened this issue Jan 6, 2015 · 8 comments
Closed

Getting an error trying to run #26

rpoole opened this issue Jan 6, 2015 · 8 comments

Comments

@rpoole
Copy link

rpoole commented Jan 6, 2015

Whenever I try to use the program I get a python error:

Traceback (most recent call last):
  File "/usr/local/bin/pgcli", line 9, in <module>
    load_entry_point('pgcli==0.10.0', 'console_scripts', 'pgcli')()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pgcli/main.py", line 86, in cli
    refresh_completions(pgexecute, completer)
  File "/usr/local/lib/python2.7/dist-packages/pgcli/main.py", line 176, in refresh_completions
    tables = pgexecute.tables()
  File "/usr/local/lib/python2.7/dist-packages/pgcli/pgexecute.py", line 120, in tables
    with self.conn.cursor() as cur:
AttributeError: __exit__

Using python 2.7 and psql 9.3.5 on Ubuntu 14.04.

@sillypog
Copy link

sillypog commented Jan 6, 2015

I get a slightly different error on OSX 10.10, using Python 2.7 and Postgresql 9.2.4.

~ $pgcli --help
Traceback (most recent call last):
  File "/usr/local/bin/pgcli", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
    working_set.require(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: Click

@amjith
Copy link
Member

amjith commented Jan 6, 2015

@rpoole Can you tell me how you're launching pgcli? What are the command line params?

It looks like the database connection is failing. I should report a more sensible error message for that.

@amjith
Copy link
Member

amjith commented Jan 6, 2015

@sillypog Your error message is because Click is not installed. Click is a dependency of pgcli that should be installed when you do a pip install pgcli.

Can you tell me how you installed pgcli?

@thiagophx
Copy link

Hi @amjith, thanks a lot for this project!
I get the same error as @sillypog, and I did install pgcli using pip.
Here's the output:

$ pgcli
Traceback (most recent call last):
  File "/usr/local/bin/pgcli", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
    working_set.require(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: Click

$ pip install pgcli
Requirement already satisfied (use --upgrade to upgrade): pgcli in /Library/Python/2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): Click in /Library/Python/2.7/site-packages (from pgcli)
Requirement already satisfied (use --upgrade to upgrade): prompt-toolkit in /Library/Python/2.7/site-packages (from pgcli)
Requirement already satisfied (use --upgrade to upgrade): psycopg2 in /Library/Python/2.7/site-packages (from pgcli)
Requirement already satisfied (use --upgrade to upgrade): sqlparse in /Library/Python/2.7/site-packages (from pgcli)
Requirement already satisfied (use --upgrade to upgrade): docopt in /Library/Python/2.7/site-packages (from prompt-toolkit->pgcli)
Requirement already satisfied (use --upgrade to upgrade): jedi>=0.8.1 in /Library/Python/2.7/site-packages (from prompt-toolkit->pgcli)
Requirement already satisfied (use --upgrade to upgrade): pygments in /Library/Python/2.7/site-packages (from prompt-toolkit->pgcli)
Requirement already satisfied (use --upgrade to upgrade): six>=1.8.0 in /Library/Python/2.7/site-packages (from prompt-toolkit->pgcli)
Requirement already satisfied (use --upgrade to upgrade): wcwidth in /Library/Python/2.7/site-packages (from prompt-toolkit->pgcli)
Cleaning up...

$ which python
/usr/bin/python

$ pip freeze | grep 'click\|pgcli'
click==3.3
pgcli==0.10.0

It seems that pgcli and click were installed successfully, but it still doesn't work.
Any idea why?

Thanks in advance.

@amjith
Copy link
Member

amjith commented Jan 6, 2015

@sillypog @thiagophx Let's track this issue on #27. The original issue reported by @rpoole seems unrelated to the ones you guys are facing.

@cezio
Copy link

cezio commented Jan 6, 2015

@rpoole Which psycopg version you're using? Context Manager support in cursor was added in 2.5 http://pythonhosted.org//psycopg2/news.html#what-s-new-in-psycopg-2-5

@rpoole
Copy link
Author

rpoole commented Jan 7, 2015

@cezio that was it! I had an old version of psycopg2 (2.4.5).

Thanks for the help and the hard work on the tool - it looks great!

@amjith
Copy link
Member

amjith commented Jan 7, 2015

Version 0.10.1 released to PyPI. https://pypi.python.org/pypi/pgcli/0.10.1

@amjith amjith closed this as completed Jan 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants