Globals Browser broken?

2010-11-19
2013-03-15
  • Robert Rollins
    Robert Rollins
    2010-11-19

    When I press Cmd-Shift-T (aka Open Type, which opens the Python: Globals Browser dialog), and type out a class I'd like to open, the browser finds the class just fine, but fails to actually open the file.  Pressing Enter dismissed the dialog, but no file actually opens.
    This worked just fine with Eclipse 3.4.0, but I've recently been testing out Eclipse 3.6 to see if my code shop could seamlessly upgrade, and this apparent bug is a serious showstopper.

    My environment is:
    Mac OSX 10.6.5
    Eclipse Version: Helios Service Release 1, Build id: 20100917-0705 (Java EE package)
    Pydev version: 1.6.3.2010100513

    After some additional poking around, I found the error log, which contains a stacktrace like this one for every time I tried to use the Globals Browser:
    !ENTRY org.python.pydev.core 4 4 2010-11-19 14:15:26.172
    !MESSAGE Unable to resolve module for:L/events/events/integration/ws/GetPerson.py
    !STACK 0
    java.lang.RuntimeException: Unable to resolve module for:L/events/events/integration/ws/GetPerson.py
    at org.python.pydev.builder.PyDevBuilderVisitor.getModuleName(PyDevBuilderVisitor.java:203)
    at com.python.pydev.analysis.builder.AnalysisBuilderVisitor.doVisitChangedResource(AnalysisBuilderVisitor.java:147)
    at com.python.pydev.analysis.builder.AnalysisParserObserver.parserChanged(AnalysisParserObserver.java:111)
    at org.python.pydev.parser.PyParser.fireParserChanged(PyParser.java:341)
    at org.python.pydev.parser.PyParser.reparseDocument(PyParser.java:461)
    at org.python.pydev.parser.ParserScheduler.reparseDocument(ParserScheduler.java:150)
    at org.python.pydev.parser.ParsingThread.run(ParsingThread.java:46)

    I don't know what that "L" is in the path to my GetPerson.py file, but maybe that's the problem?

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2010-11-21

    Does this happen with all files? (can you try with some model from another project?) What seems to be happening in this case is that this particular file is not in your pythonpath (the L there is okay as that's the representation of the file within the eclipse workspace).

    Can you try doing 2 things:
    1. in your 'events' project, see if the source folder is properly set
    2. If it is, at the same place your configure the pythonpath for the project (project > properties > pydev-pythonpath), click the 'force restore internal intfo' to see if that fixes the internal caches for the pythonpath in case there's some problem there.

    If the error persists, please report back.

    Cheers,

    Fabio

     
  • Robert Rollins
    Robert Rollins
    2010-11-22

    Force restore internal info did seem to have fixed that problem, but I think it may have been the cause of a much worse failure that showed up after the globals browser started working again.  For some reason I could no longer import anything from any project besides my the local one.  I double and triple checked the project dependencies, did a few more "force restore internal info" tests, and even tried updating to the newest nightly build of Pydev, but nothing worked.

    The only way I managed to fix it was completely deleting my workspace and starting totally fresh.  I think something must have gotten corrupted in my workspace metadata, because starting from scratch finally fixed all the problems I was having.

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2010-11-22

    Humm, strange, but you mentioned you were coming from eclipse 3.4 to 3.6, so, updating the version + updating pydev could have something to do with pydev getting lost. I'll take a look here to see what could cause that (in the meanwhile, if you are able to replicate that somehow and pass me instructions on that, it'd probably be easier to fix it).

    Cheers,

    Fabio

     
  • Robert Rollins
    Robert Rollins
    2010-11-22

    Unfortunately, I'm really not certain what actually caused the import failure to manifest, and I'm really too busy to play around with another copy of Eclipse to try to make it happen again.  However, I'll try to be as specific as I can be about what I remember doing:

    First, I installed Eclipse 3.6 into a different folder than my 3.4 install, because I didn't want to screw up my working dev env.  Then I installed the plugins my code shop uses (Aptana Studio, Pydev, Subclipse, PDT), using the usual update sites.  I then tweaked some of the Eclipse settings (keybindings mostly), but I didn't touch anything related to imports of PYTHONPATH.

    After checking out all my projects through SVN, I realized that I needed to set up the default Python interpreter, so it set it to the MacPorts Python 2.5 install that my shop uses (the built-in Python on OSX is unsuitable for our projects).  Then I started doing some dev work, and discovered the broken Globals Browser.  I did several things to try and make it work, including updating to the newest nightly build (using www.pydev.org/nightly), but that didn't do anything.  I *think* that using "Force restore internal info" on my project is what made the Globals Browser work, but that was when I also started getting import errors on everything outside of my project (and even things that were in the same project but under a different package tree than the erroring file).

    It was at that point that I deleted my workspace folder and started fresh, and I didn't have any problems after that. 

    And thinking about that folder made me remember that at some point during that whole operation, I moved my workspace folder. I'd accidentally created it in ~/Documents/workspace-test instead of ~/dev/workspace-test).  I remembered being screwed by Finder's total ignorance of .files, so instead of moving the contents of the folder, I moved the whole thing from ~/Documents to ~/dev.  Maybe that's what messed it up?  Something in Eclipse or Pydev may be saving absolute paths instead of workspace-relative paths.

    Anyway, I hope my description helps you figure out this problem.  I'd hate for anyone else to go through the same frustration I suffered.

     
  • Robert Rollins
    Robert Rollins
    2010-11-30

    So after a bit more use of Eclipse 3.6, I decided to stick with it and recommend the upgrade to my team.  So, I moved my test workspace back to my normal workspace folder… and this globals browser bug popped up again.    This also broke all my debugging, because Pydev can't figure out where my modules are.  It really looks like there's something in Pydev that's improperly using absolute paths instead of workspace-local paths (or maybe saving the workspace path somewhere and not updating it when the workspace path changes?).
    I'm getting that same exception as last time:
       java.lang.RuntimeException: Unable to resolve module for:L/events/events/ui/action/home.py
    That path is perfectly fine, but I'm guessing that the L is being interpreted as my old workspace path, rather than my new one.

    Is there any safe way to force Pydev to update my workspace path?  Last time I used the "Force restore internal info" button it didn't work.

     
  • Robert Rollins
    Robert Rollins
    2010-11-30

    OK, after a lot more tinkering, I fixed the problem.  It looks like my issue was 2-fold:
    1) Files that I had open in Eclipse before moving my workspace were re-opened after moving my workspace.  They seemed to be opened just fine, but Eclipse was internally considering them to still be in my old workspace path.  This was causing all kinds of internal havoc when trying to run my code.  Closing and re-opening the files finally made them realize where they really were… but that didn't fix the failed import problem.
    2) The failed imports I was getting when trying to run my code were because Pydev stores absolute paths internally, in files like "workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/MY_PROJECT/com.python.pydev.analysis/AdditionalProjectInterpreterInfo.pydevinfo".  Doing a "force restore internal info" on every single project in my workspace finally got rid of all the old absolute paths, and my project works again.  It'd be nice if that wasn't necessary.