Results 1 to 3 of 3

Thread: Python - wait time problem

  1. #1
    Join Date
    Dec 2010
    Beans
    2

    Python - wait time problem

    Hey, I've been working on a project for a while now. What it does is, it reads data from a website every five minutes, then updates itself. Thing is, I'm having a little trouble getting it to wait five minutes. This is what I have been using in python:

    Code:
    x = 1
            while x == 1:
                self.get_data
                time.sleep(300)
    It's a tkinter application I'm running this through basically, but that's what I was doing to get it to go every 5 minutes. Unfortunately, whenever I do, I get the error:
    "AttributeError: 'str' object has no attribute 'sleep'"
    Which makes no sense to me, because I'm importing from the time module.

  2. #2
    Join Date
    Jul 2009
    Location
    London
    Beans
    1,480
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Python - wait time problem

    at some point you must have assigned a string variable to time, so that you've lost the reference to the time module.

    search your code for something like:
    time = ??something??

  3. #3
    Join Date
    Dec 2010
    Beans
    2

    Re: Python - wait time problem

    Ah, turns out I had by accident. Thanks mate!

    Although, now the tkinter window isn't opening. Oh dear.
    Last edited by Dragice; December 2nd, 2010 at 07:48 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •