Top-level of external library sources is detected incorrectly

Hi!

I have WSGI project in PyCharm. It uses virtualenv. I installed repoze.what library, but, in contrast to other libraries, its top-level package detected incorrectly.

Screen shot 2012-08-22 at 9.23.26 AM.png


As you can see, only adapters package is root, but repoze and what also must be. As in SQLAlchemy, for example:


Screen shot 2012-08-22 at 9.41.25 AM.png


Do you have any ideas how to solve it?

Thanks,
  Boris.
7 comments
Comment actions Permalink
Please try PyCharm 2.6 EAP, which adds support for namespace packages:
http://blog.jetbrains.com/pycharm/2012/08/flask-in-pycharm-26-eap/
0
Comment actions Permalink
Hi, Dmitry!

I tried it on PyCharm 2.6.1. Autoimport by Cmd+Enter works, import are added, but they are still incorrect.

Screen shot 2012-09-17 at 10.18.22 AM.png
0
Comment actions Permalink
The parent directory of repoze should be listed as a root in your interpreter settings (PyCharm should do it automatically under normal circumstances, let's find out why it didn't).

Please provide more details on 1) what are your root folders (static paths: Settings -> Python Interpreters -> (Your interpreter) -> Path, dynamic paths: import sys; print(sys.path) in the command line inside PyCharm), 2) how did you create your virtualenv and install packages into it.
0
Comment actions Permalink
Hi, Andrey!

Thanks for quick reply.

Here is sys.path output:

import sys
print sys.path

['/Applications/PyCharm.app/helpers/pydev', '/Users/Marboni/Projects/ODM/ODM-API/env/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', '/Users/Marboni/Projects/ODM/ODM-API/env/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg', '/Users/Marboni/Projects/ODM/ODM-API/env/lib/python27.zip', '/Users/Marboni/Projects/ODM/ODM-API/env/lib/python2.7', '/Users/Marboni/Projects/ODM/ODM-API/env/lib/python2.7/plat-darwin', '/Users/Marboni/Projects/ODM/ODM-API/env/lib/python2.7/plat-mac', '/Users/Marboni/Projects/ODM/ODM-API/env/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/Marboni/Projects/ODM/ODM-API/env/lib/python2.7/lib-tk', '/Users/Marboni/Projects/ODM/ODM-API/env/lib/python2.7/lib-old', '/Users/Marboni/Projects/ODM/ODM-API/env/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/Marboni/Projects/ODM/ODM-API/env/lib/python2.7/site-packages', '/Users/Marboni/Projects/ODM/ODM-API/odmapi']

Interpreter's paths:

Screen shot 2012-09-18 at 8.20.58 AM.png


I created virtualenv by following way:

/Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenv /Users/Marboni/Projects/ODM/ODM-API/env

(–no-site-packages flag is deprecated).

I install packages using pip from /Users/Marboni/Projects/ODM/ODM-API/env/bin directory.


I'd like to notice again that this issue occurs with repoze packages only, other detected well.
0
Comment actions Permalink
Hi Boris,
the problem with repoze.what is that it has no __init__.py files in packages repoze and what. That's why PyCharm doesn't treat them as packages.
0
Comment actions Permalink
Hi, traff.

You're right, it seems to be incorrect. I'll write to repoze devs to solve it.

Thank you.
0
Comment actions Permalink
__init__.py not exists because of bug in pip.

http://bugs.python.org/setuptools/issue113

It doesn't occur if package installed with easy_install.
0

Please sign in to leave a comment.