0

I'm new to PyDev and fairly rusty in Python. Trying to get back into it with a simple reddit app first. So here's my setup:

I have 2 PyDev projects: reddit and pylons (reddit api.py imports from pylons).

When I go into any file in the reddit project I get "unresolved import" for anything that tries to import from pylons. In reddit's PYTHONPATH, I've tried adding /pylons and /pylons/pylons, but whenever I refresh the project, PyDev seems to rename my references to /reddit and /reddit/pylons.

How do I fix this? How do I properly add the pylons project into the PYTHONPATH of reddit?

jayjyli
  • 771
  • 3
  • 11
  • 23

2 Answers2

0

The most proper way to include another project source into your PYTHONPATH is to make a reference from your project to another project. For this make next steps:

  1. Choose your project in PyDev Package Explorer (usually tree-like panel on the left).
  2. Press Alt + Enter.
  3. Click Project References tab.
  4. Check Pylons project in a tab content frame.

Note, that path with source of both projects must be added to python path for Eclipse to build references for them.

Note #2 Also when you install some new Python packages you need to reindex them at Window > Preferences > PyDev > Interpreter - Python.

Community
  • 1
  • 1
Rostyslav Dzinko
  • 39,424
  • 5
  • 49
  • 62
  • I've already checked the box next to `pylons` in the Project References window. Still renames and does not recognize. Also for your note #1, do you mind clarifying which path you're referring to? – jayjyli Aug 20 '12 at 20:11
  • @PhADDinTraining What Eclipse does is package indexing and if newly installed packages are not indexed - it will mark them as unresolved imports. – Rostyslav Dzinko Aug 20 '12 at 20:15
0

Since Rostyslav's solution is not working for you, perhaps you should try to add pylons as an external library. At reddit's Properties window click PyDev-PYTHONPATH tab and the External Libraries tab. Click Add source folder and find pylons's source folder. Changes to external libraries are not monitored. So you have to use Force restore internal info when pydev can't find new references (tipically when you make changes to pylons's structure).

jheyse
  • 489
  • 1
  • 7
  • 21