#897 Can't use with project referencing (bug on Python 3.0)

1.4.4
closed-fixed
nobody
None
5
2014-08-15
2009-04-16
No

PyDev 1.4.4 and 1.4.5 discards local 'import' when project references
are used.

Not only limited to refer other project but also modules in same
project. I created files for test case below. Please test it.

1. Create new workbench.

Follow Menu: File -> Switch Workspace -> Other.
'Workspace launcher' pops up.
To create new workspace, type the path to new (or empty) folder in
'Workspace:' textbox.
Press OK Button.
Go to the workbench after the Eclipse restarts.

2. Create new Pydev project.

Follow Menu: File -> New -> Project... 'New Project' dialog pops up.
Select Pydev - 'Pydev Project' in the tree.
Press Next Button.
Type Project Name 'proj_a'.
Check(activate) 'Use default' checkbox.
Select 'Python' radio button in 'choose the project type'.
Select '3.0' in Grammer version.
Check(activate) 'Create default 'src' folder and add it to the
pythonpath?' checkbox.
Select 'Default' or '3.0' in Interpreter combobox.
Press Finish Button.

3. Create new Pydev package.

Click Right button of pointing device(mouse or etc.) on proj_a
in Pydev Package Explorer.
Select New -> 'Pydev Package' in popup menu.
Type package name 'testmod_a' in Name textbox.
Press Finish Button.
'testmod_a' is created under proj_a/src, and __init__.py is under
proj_a/src/testmod_a.

4. Add module in package.

Drag testfunc.py into proj_a/src/testmod_a.
testfunc.py has a function 'test_print()'.

5. Add test caller outside the package.

Drag testcaller_a.py in proj_a/src but OUTSIDE testmod_a.
'testcaller_a.py' is copied under proj_a/src, not proj_a/src/testmod_a.

6. Run testcaller_a.py.

Click Right button on testcaller.py.
Select Run As -> Python Run in popup menu.
Check testcaller_a.py is in proper place and 'test_print()' is called
successfully.

7. Create another project in same workspace.

Follow Menu: File -> New -> Pydev Project.
Fill Project Name with 'proj_b', and make other options same with proj_a.
Press Finish Button (to make problem clear, reference to proj_a is not
set now. it will be created after).

8. Create testmod_b in proj_b.

Like testmod_a, create testmod_b. 'testfunc.py' is copied also.

9. Create main folder in proj_b.

Click Right button on proj_b/src.
Select New -> Folder. 'New Folder' dialog pops up.
Give some name you want, example 'maintest' here.

10. Add testcaller_b.py in proj_b/src/maintest.

Drag testcaller_b.py to proj_b/src/maintest.

11. Run maintest/testcaller_b.py and check sys.path.

Click Right button on testcaller.py.
Select Run As -> Python Run in popup menu.
Now, check 'sys.path', should be following:

C:\workspace\proj_b\src\maintest
C:\workspace\proj_b\src
C:\Python30
C:\Python30\DLLs
C:\Python30\lib
C:\Python30\lib\plat-win
C:\Python30\lib\site-packages
C:\WINDOWS\system32\python30.zip

Both proj_b/src/maintest and proj_b/src/ are included in
sys.path (PYTHONPATH).

12. Add testcaller_b.py in proj_b/src.

Next, drag testcaller_b.py to proj_b/src.

13. Run proj_b/src/testcaller_b.py and check sys.path.

Run latest added testcaller_b.py and check sys.path.
The first 2 lines should be following:

C:\workspace\proj_b\src
C:\workspace\proj_b\src
(... system python paths ...)

The first 2 paths are same, but works fine.
This behavior is correct.

14. Make reference from proj_b to proj_a.

Click Right button on proj_b.
Select Properties. 'Properties for proj_b' dialog pops up.
Select 'Project References' in left tree.
Check proj_a in right pane.
Press OK button.

15. Rerun testcaller_b.py.

proj_b/src/testcaller_b.py is still fine, but one in maintest
raise exception. And sys.path doesn't include proj_b/src (only
proj_b/src/maintest remains).

These behaviors are INCORRECT.

15. Add testcaller_a.py in proj_b/src and proj_b/src/maintest.

Drug testcaller_a.py besides both testcaller_b.py.

16. Run testcaller_a.py.

We made reference in step 14 as shown, so they both must work.
But both of them don't work.
'sys.path' includes the folder in which testcaller_a.py, but,
both proj_b/src/ and proj_a/src/ are disappeared.

These behaviors are INCORRECT.

Check final structure of our workspace:

proj_a
+--src
+--testmod_a
| +--__init__.py
| +--testfunc.py
+--testcaller_a.py
proj_b
+--src
+--maintest
| +--testcaller_a.py
| +--testcaller_b.py
+--testmod_b
| +--__init__.py
| +--testfunc.py
+--testcaller_a.py
+--testcaller_b.py

Thanks for testing.
Suzumizaki-Kimitaka

Discussion

  • 鈴見咲君高

    鈴見咲君高 - 2009-04-16

    Testcase for project referencing bug.

     
  • 鈴見咲君高

    鈴見咲君高 - 2009-04-17

    Sorry, I forgot to add my environment:

    OS: Windows XP Home Edition Version 2002 SP3 Japanese Edition
    Pydev: both 1.4.4 and 1.4.5 I tried.
    Eclipse version: 3.4.2, M20090211-1700
    Eclipse Install at: C:\eclipseexe\exclipse\ Python: 3.0.1 32bit for windows.
    Project location where the bug appears:
    seems anywhere. I tried C:\eclipse_workspace\py3 and such.

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-04-22

    Project with the tested structure

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-04-22
    • status: open --> pending
     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-04-22

    Hi, I have checked in the latest nightly build (1.4.6.2738) and it seems to work for me (did not check in the specified version). I've attached the projects I used (with the info for pydev, so, it should be just a matter of importing those into your workspace and check if they work -- and you can also check if that's the structure you were expecting).

    Can you check if that works for you?

    Thanks,

    Fabio

     
  • 鈴見咲君高

    鈴見咲君高 - 2009-04-23

    Thank you for checking.

    I tried with eclipse installed again and with PyDev nightly 1.4.6.2738.
    But the testcase doesn't work (ProjectStructure.zip is that I expected to test, thanks).

    I found the case is working with Python 2.5(.4) and 2.6(.2) interpreters.
    Only with Python 3.0(.1), it doesn't work.

    If you haven't test with Python 3.0+ interpreter, please check with it.
    Otherwise... mmmm..., is there any ideas to make the problem clear...?

    Suzumizaki-Kimitaka

     
  • 鈴見咲君高

    鈴見咲君高 - 2009-04-23
    • status: pending --> open
     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-05-02
    • status: open --> pending
     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-05-02

    Well, it seems to me it's working with python 3.0. Can you check with the latest nightly build (at least 1.4.6.2752 -- instructions to get it are available at: http://pydev.blogspot.com/2009/02/pydev-nightly-builds.html -- it shows configuration errors in the pydev package explorer, so, it could help in diagnosing the error).

    Also, can you check if you have something in your error log?

     
  • 鈴見咲君高

    鈴見咲君高 - 2009-05-04

    Several screen shots.

     
  • 鈴見咲君高

    鈴見咲君高 - 2009-05-04

    I tested with 1.4.6.2752, but I can't found the way to detect what's wrong, nothing new changes in error consoles.

    There are new elements on pydev package explorer as you say, but seems no errors.
    I took several screenshots, please check it.
    As shown, the configurations themselves are fine.

    Thanks,
    Suzumizaki-Kimitaka

     
  • 鈴見咲君高

    鈴見咲君高 - 2009-05-04
    • status: pending --> open
     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-05-04
    • summary: Can't use with project referencing --> Can't use with project referencing on Python 3.0
     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-05-04

    Ok, just as a note, I've been able to reproduce... and it seems it's a Python 3.0 bug. I've checked with Python 3.0, so, I'll still check with Python 3.0.1 to see if it happens there (I've been able to reproduce the same error when running it from the command-line, not only from Eclipse, which indicates a Python bug and not a Pydev bug)

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-05-04

    Ok, I've created a Python bug at: http://bugs.python.org/issue5924

    So, to have it properly working, Python (and not Pydev) needs to be fixed... I'll leave this bug open as a sign for others with the same problem (until that bug is fixed for Python)

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-05-20
    • summary: Can't use with project referencing on Python 3.0 --> Can't use with project referencing (bug on Python 3.0)
     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-06-18

    Ok, this was fixed at the python side at 2009-06-09 (so, a release after that should have it fixed)

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-06-18
    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks