Найти - Пользователи
Полная версия: Проблема с Threading
Начало » Python для новичков » Проблема с Threading
1
UsCr
Здравсвуйте. Делаю так:

import commands
import threading

class Idletime(threading.Thread):
def run(self):
idle=commands.getoutput('xprintidle')
time.sleep(5)
def getidletime():
return idle
Потом так:

test = Idletime
test.start()

А меня ругает вот так:
Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
test.start()
TypeError: unbound method start() must be called with Idletime instance as first argument (got nothing instead)
Что я понял не так?

OC: Ubuntu 10.10
dimabest
test = Idletime()
test.start()
UsCr
Спасибо, я дурак.

Собственно, это не то, что мне нужно, как оказалось. Уже нашёл полезную тему : http://python.su/forum/viewtopic.php?id=2019
UsCr
У меня созрел ламерский вопрос. Вот я нашёл ещё статью (помимо той, что я указывал) - http://code.activestate.com/recipes/278731-creating-a-daemon-the-python-way/. Но, собственно, каким образом запустить нечто в качестве демона? В коде нет указаний на что0либо, что будет демонизированно.
dimabest
я использую готовую либу python-daemon
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB