omikron
omikron

Reputation: 2826

PyDev can't recognize all module members correctly

I have two examples:

enter image description here

As you can see PyDev marks Process in first example and PULL in second as "Undefined variable from import (...)". However, code is executed without any problems. It's just PyDev can't resolve those names.

Taking a closer look on multiprocessing and zmq modules I found that members that can't be recognized are imported in some weird way by updating globals.

Is there a way to make PyDev evaluate those import files more thoroughly?

Upvotes: 1

Views: 185

Answers (2)

Harris.Atlarge
Harris.Atlarge

Reputation: 181

This has been a real pain with getting PyDev to recognize all the objects from pyzmq. As Fabio suggests via the link, set zmq as a forced built-in and it should solve the issue. I'm using zmq with gevent so in my case I import zmq as follows ...

import zmq.green as zmq

Using the latest PyDev in Eclipse: Windows > Preferences > PyDev > Interpreters > Python Interpreter > Forced Builtins > New.

Just add zmq for "Builtin to add". I would close the project(s) and restart Eclipse. You may need to close / reopen the module(s) showing the errors and / or do a Project > clean. The zmq errors should go away.

Upvotes: 1

Fabio Zadrozny
Fabio Zadrozny

Reputation: 25372

Yes, you can ask PyDev to analyze modules through a shell.

See: http://pydev.org/manual_101_interpreter.html for more details (mostly the forced builtins part).

Upvotes: 2

Related Questions