Menu ▾ ▴

Adding new modules to Pydev

aotlee
2007-05-11
2013-03-15
  • aotlee

    aotlee - 2007-05-11

    I have enjoyed using many built in modules so far in my coding -- however, I felt it was time to add a new one, for use with creating/manipulating sounds in Tkinter (in this case, tkSnack).

    I believe I have installed it correctly, as it works in the Terminal well enough. However, I went to configure Pydev, adding the lib folder (where I put tkSnack.py) to my PYTHONPATH, but it doesn't seem to work. I am able to import the module without errors but not able to use any of its functions. I get the message:

    NameError: name 'initializeSnack' is not defined

    The same goes for any other function I try (e.g., Sound).

    Is it possible that I added the wrong folder, or should I have done something else entirely?

    If anyone has any suggestions, I would really appreciate them.

     
    • Fabio Zadrozny

      Fabio Zadrozny - 2007-05-11

      Well, you have to give more details on its structure and folders you added to the pythonpath (vs. folders you have in your pythonpath when you're in the shell).

      Cheers,

      Fabio

       
    • aotlee

      aotlee - 2007-05-11

      To be honest, I have a very tenuous grasp on things involving file structure and access. I have no idea, for example, what folders I have in my pythonpath when I'm in the Terminal/shell or how to find that out (!). As for Pydev, I've added the folder:

      /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5

      Which is where I stuck tkSnack.py. (There seem to be loads of other .py files there, so I thought it was worth a shot.)

      Also, just as a note, I tried what the Pydev configuration instructions suggest and removed and re-added my interpreter -- didn't help. :(

       
      • Fabio Zadrozny

        Fabio Zadrozny - 2007-05-11

        To see what's the pythonpath you're using (from eclipse or from the shell), run your script starting with:

        import sys
        for p in sys.path: print p

        Cheers,

        Fabio

         
    • aotlee

      aotlee - 2007-05-11

      Here is what I get when I do that:

      /Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip
      /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
      /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin
      /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac
      /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages
      /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk
      /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload
      /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages

      I see all of those appear in my Pydev pythonpath.

      The really strange thing to me is that I get no import error -- it knows that the module is there, it just can't seem to access its functions. Maybe there are some additional tkSnack files I should move into the lib directory?