missing collections module

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arunach
    New Member
    • Jan 2010
    • 3

    missing collections module

    Hi Experts,
    I've installed python 2.4 and importing the module 'collections' in one of my script and the "No module named collections" message is displayed in command prompt.
    I've read a thread with same topic(http://bytes.com/topic/python/answers/559775-missing-collections-module), where the suggestion was to upgrade the python version to 2.4 or 2.5.
    But here i'm already in version 2.4, also i made a search for 'collections' on the directory, where python was installed, but nothing found.
    Please can you suggest at the earliest.

    Thanks,
    Arun
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    The collections module is new to Python 2.4 and should be found in the Lib subdirectory. I run Python 2.6 on my laptop, and it imports without problem.

    BV

    Comment

    • arunach
      New Member
      • Jan 2010
      • 3

      #3
      Hi BV,
      Thanks for the response. I searched for 'collections.py ' file in the whole directory where python was installed(inclu ding 'Python\Lib'), but search result is zero.

      Thanks,
      Arun

      Comment

      • Glenton
        Recognized Expert Contributor
        • Nov 2008
        • 391

        #4
        Hi. I'm using python 2.6 on Ubuntu and also am able to import collections without any problem.

        Where did you install from? What system are you using?

        Comment

        • arunach
          New Member
          • Jan 2010
          • 3

          #5
          Hi Glenton,
          I'm using python 2.4 on windows. The 'collections' module should be available from version 2.4, but it's missing.
          -Arun

          Comment

          • Glenton
            Recognized Expert Contributor
            • Nov 2008
            • 391

            #6
            Okay, forgive my skepticism. Do you have more than one version installed? Are you running Idle or what?

            In the python prompt, try this:
            Code:
            import platform
            platform.python_version()
            Often what happens is that people have several versions on their machine, and the command to run a script uses a different version from the command prompt. This is a weird subtlety that sometimes trips people up.

            For example most python commands from an IDE just specify python, and there'll be some environmental variable that converts python into python2.x or whatever.

            Anyway, let us know what you get from the above command, and we'll see if that's the issue...

            Comment

            Working...