Forums

Cannot import Peewee ORM due to 'unable to detect undefined names'

Hey all, I'm brand new to Pythonanywhere and I've been learning Flask through a Treehouse course. In that course, the instructor uses Peewee as the ORM and it's the one I've gotten comfortable with.

Unfortunately, I can't get Peewee to import properly. As per Peewee documentation the proper method to import is:

from Peewee import *

But when using this line, I get this as a warning in the margins:

'from Peewee import *' used; unable to detect undefined names' error.

I haven't had this issue working off of Treehouse's workspaces or locally on a PyCharm project. Googling this issue hasn't yielded any results and I'm not sure what else might be causing it. For reference, I'm running a project here on Python 3.5.

Any help would be much appreciated. Thanks!

That is just a warning from the editor

ie. it is bad style/bad practice to do from XXX import * because then we can't check your code for undefined name errors.

If you want to warning to go away you should import what you are using explicitly instead of using *

Hey Conrad, thanks for the response. I'm aware that it's bad practice- the course instructor made that clear as well and stated that Peewee was one exception we'd have to make. There are simply too many things to import.

Is there a way to bypass this warning using *?

maybe see if # NOQA works?

That works! Thanks :D