{"id":24685,"library":"taskthread","title":"taskthread","description":"A lightweight Python module for running a repetitive task on a single dedicated thread. Currently at version 1.4, with infrequent releases.","status":"active","version":"1.4","language":"python","source_language":"en","source_url":"https://github.com/rakanalh/taskthread","tags":["thread","scheduler","repetitive-task"],"install":[{"cmd":"pip install taskthread","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The main class is always imported from 'taskthread'.","symbol":"TaskThread","correct":"from taskthread import TaskThread"}],"quickstart":{"code":"from taskthread import TaskThread\nimport time\n\ndef my_task():\n    print(\"Task execution at\", time.time())\n\n# Run my_task every 2 seconds\nt = TaskThread(my_task, 2)\nt.start()\ntime.sleep(10)  # Let it run for a while\nt.stop()","lang":"python","description":"Create a TaskThread that executes my_task every 2 seconds, start it, then stop after 10 seconds."},"warnings":[{"fix":"Ensure interval is in seconds (e.g., 0.5 for 500ms).","message":"The interval parameter is in seconds (float), not milliseconds. Passing a value like 1000 will cause a long delay.","severity":"gotcha","affected_versions":"All"},{"fix":"Design tasks to complete quickly or add your own synchronization.","message":"TaskThread uses a simple while loop with sleep; if the task takes longer than the interval, they will overlap because no lock is used.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from taskthread import TaskThread'.","cause":"Incorrect import statement (e.g., 'import taskthread' then 'taskthread.TaskThread').","error":"AttributeError: module 'taskthread' has no attribute 'TaskThread'"},{"fix":"Ensure first argument is a function or callable object.","cause":"Passed a float as the first argument instead of a callable.","error":"TypeError: 'float' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}