Reputation: 17333
I have the following structure:
home.py
logic/brains/databeam.py
Inside databeam.py
I have:
engine = create_engine(databaseSettings(), pool_size = 20, max_overflow = 0)
Session = sessionmaker(bind = engine)
session = Session()
boom = 'boom'
And in home.py
:
from logic.brains.databeam import session, boom
print session
print session.query()
print boom
Everything works as intended, but PyDev on eclipse shows me this:
Instead of using from logic.brains.databeam import session as session, boom as boom
, I do this:
import logic.brains.databeam
session = logic.brains.databeam.session
boom = logic.brains.databeam.boom
But this seems untidy, is there a better way to show PyDev that the import works?
Upvotes: 1
Views: 3417
Reputation: 35
Really simple script producing the same error in Eclipse 2019-09 with PyDev 8.1.0.202012051215:
import re
flag = re.ASCII
It seems PyDev isn't inferring things exported using globals().update(). The following is equivalent and works (in this case):
import re
flag = re.RegexFlag.ASCII
Upvotes: 2
Reputation: 83427
As a way to circumvent the issue, I used:
then a bunch of
and
will appear. To hide them:
Upvotes: 1
Reputation: 41
@Lars, I can not comment on previous post, so i will put my comment here. If you have an error "Undefined variable from import" like @Morgan Wilde had with query, you should put Warning on that option under tab Undefined not Imports.
Upvotes: 1
Reputation: 17333
A solution that I found to be reasonable is to suppress this type of error in PyDev
altogether. I know this is not perfect, but far and away the best one I've come across.
How to change this setting:
Upvotes: 1