I'm not going to provide the code because it's too long. The python script involves executing a lengthy number of commands run in a while loop.
Basic structure
while True:
The meat goes here
with the odd if:
and stuff
Now that I'm finished it, I'm noticing that upon running it, it uses 100% CPU, no exceptions. I'm a beginner and don't really know what to attribute this issue to. I thought that maybe because the script runs indefinitely (until I exit it manually) it might just be taxing on the CPU if it's repeating the loop a number of times a second. I added time.sleep(1) at the bottom of the while to see if that was the issue with no improvements.
Anyone have any ideas? It is quite a long sequence of events, but they are heavily dependent on an if statement which isn't triggered all that often. The 100% CPU usage occurs before that particular if statement is even triggered, so I'm really at a loss.
Edit: forgot to include that it's running in a unix environment (Debian)
while True:line, and it didn't help, then I think we need to see more code before we can help you.continuestatements in your code which could be skipping over the sleep (if it's at the bottom of the while loop)?