#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    2
    Rep Power
    0

    Threading in Windows


    Hello all,

    I am trying to build a program which will spawn a number of threads each of which will be running concurrently.

    I would like to do this in python on windows but I have been unable to get the Thread class imported

    Code:
    Traceback (most recent call last):
      File "D:/projects/sounds/for random/threading2.py", line 1, in ?
        from threading import Thread
    ImportError: cannot import name Thread
    Is there something obvious that I am missing?

    Thanks,

    Matt
  2. #2
  3. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    14
    If you run IDLE or open a Python console you should be able to enter the same instructions:
    Code:
    >>> from threading import Thread
    >>> dir()
    ['Thread', '__builtins__', '__doc__', '__name__']
    >>>
    If that does not work then soemthing went wrong with your installation.

    If it does work then perhaps your program is modifying the PYTHONPATH with sys.path() at some point before the import statement.

    grim

IMN logo majestic logo threadwatch logo seochat tools logo