Cannot get autocomplete to work on imported modules


I have some very simple code where auto completion doesn't work.  I tried searching the internet and docs for a few hours to no avail. At any rate I have source in a couple directories. The tree looks like this


for source located in the file system directory I commonly have to import things from the libs directory.  so I have some code like this
import os
import sys
import random
import logging
import traceback

from time import sleep, time

if "libs" not in os.listdir():


from libs import utils
from libs import OS
from libs import datacomp
from libs import constants
from libs import iofactory
from libs import rpclib
from import TestCase

so at this point there are a few notes.  Previoiusly it seems like pycharm didn't understand the path addition in the file or otherwise know how to resolve libs.  I added a symlink to in the file_system directory to libs and it got rid of the red squiggly unresolved reference error on the import line, but auto complete still doesn't work at all. so when i type something like this

blah = rpclib.rpc("hf://")
blah.<expecting a big list of class methods and defs here>

I get nothing. in addition the rpclib constants and methods don't show up either. Well some stuff that I typed in by hand does but that's about it

Verified python paths are good
tried adding these specific directories as sources in the project

autocomplete works on komodo and eclipse, just not here

Any guidance would be great

Okay I have a temporary work around... It seems if I use

import <source>

rather than:

from libs import <source>

I get the proper resolution.  I guess for now I can import things through a try / except clause.  The problem I have is that I'm developing test automation and the target machines are guaranteed to have the source files and proper interpreter, but may not have the path variables to get this to work right.

Is there any reason why from libs import <file> shouldn't work?

This seems to only be a problem with C extension packages, even those in the standard library.
It's reported with Qt and datetime and several others.

I suspected it was the "from x import y" but I also get an error with "import datetime."

The tests run and the code works, but syntax highlighting calls it an error.

I get the same behavior, btw, for "int", "object", "len", "setattr" and a bunch of built-ins.

I'm using Pycharm 3.4.1 on Mac OS X 10.9.5 (if that's helpful).

Please sign in to leave a comment.