2

I'm using pydev to develop a pyclutter application. Clutter is added to the interpreter path and is in the list of forced builtins, but all the objects within clutter's namespace show up as "missing import" errors (i.e. the red squiggles).

Is there another way to force pydev's introspection to be more robust? I suspect it may be harder than usual to introspect the contents of clutter since it uses pygobject to pull the objects out of the shared C library, but if I look at the contents of the module using the in-IDE python debugger, the objects within the package all show up.

Thanks,

PerilousApricot
  • 633
  • 1
  • 7
  • 19

1 Answers1

2

Well, if you add an object there (say, 'mypy.lib'), PyDev will create a shell, import that module in it (i.e.: import mypy.lib) and do a dir in it (i.e.: dir(mypy.lib)).

If for some reason doing the dir() does work in the command line but not in the code-completion, then this may be an issue in PyDev, but I think the real problem is that some libraries don't really expose what they have on dir(), just when you access some 'known' attribute, in which case currently the only way to make it work would be creating a module with the actual interface (which then accesses things as needed) or providing "Predefined Completions" -- see the "Predefined Completions" topic at: http://pydev.org/manual_101_interpreter.html

EDIT: If the case above didn't help, it's 'usually' a PYTHONPATH misconfiguration problem (i.e.: after adding any module, you should go to the interpreter configuration and add the missing paths -- just adding/removing it usually does the trick, but note that if nothing changed in the actual paths per se, you can go to the interpreter configuration page and just press 'apply' and choose the interpreter to be reindexed) -- please let me know if this is still not your issue (just to note, I've installed clutter here and it's working properly for me).

Fabio Zadrozny
  • 24,814
  • 4
  • 66
  • 78
  • It appears that the class is in dir(module) http://cl.ly/2e1b1U0s2t1B2h0g1c3g and I've double checked that it's in the forced builtins http://cl.ly/0I001j3U3q263r1C1e2u – PerilousApricot Apr 19 '12 at 11:05
  • I've doublechecked that the right directory is added to the system PYTHONPATH http://cl.ly/3W182s3I2b0h1m160q1P – PerilousApricot Apr 20 '12 at 18:38
  • Actually, the PYTHONPATH is not correct. You should not add site-packages/clutter, only the site-packages (in fact, you should not add any other directories below the site-packages -- the PYTHONPATH should contain only the parent dir where the library is installed -- i.e.: the folder containing the clutter dir (which in turn contains the `__init__.py`) – Fabio Zadrozny Apr 20 '12 at 19:50
  • It didn't work either way, I just added the clutter directory to try to match what I saw above (where all the eggs were included in the pythonpath). The interpreter finds the libraries just fine though :/ – PerilousApricot Apr 21 '12 at 09:05
  • Try doing the following: remove the interpreter, add it again, restart eclipse (just for safety) and check if things do work... if not, please post a pic of how your pythonpath was set again. – Fabio Zadrozny Apr 24 '12 at 10:47
  • Removing the interpreter, restarting and re-adding it caused clutter to start working, but now all the zmq imports aren't showing up :/ Would it be possible to add a button to redo the PYTHONPATH configuration without removing/adding the interpreter? We have a decent number of environment variables that need to be present in the application's environment, and removing/adding the interpreter has the effect of blowing them away – PerilousApricot Apr 24 '12 at 14:05