I have a python script what works/runs most of the time but sometimes it makes Blender "Not Responding" (I closed the program after ~20 mins). What is weird that it looks like it's not even starting, because there is nothing on the Console though my script starts with a print:

import bpy
import json
import csv
import math
import struct
import imghdr
import os
import subprocess
from enum import Enum

class RuncodeEnum(Enum):
    TEST = 99


RUNCODE = RuncodeEnum.TEST

if __name__ == '__main__':
    print("Starting script, RUNCODE is '" + RUNCODE.name + "'...")

(Beside these there are a few constants and methods, likely it's not relevant.)

Any good advice what am I might doing wrong?

  • $\begingroup$ Bit hard to tell from that snippet. Often caused by infinite loops while True: for instance. Would also suggest not concatenating strings, by either using string formatting or for simple test prints: print("foo ", bar, 2000, "another string") $\endgroup$
    – batFINGER
    Jan 29, 2018 at 7:47
  • $\begingroup$ Don't get me wrong, I'm not a Python expert, but the program "should" start at that point, but there is nothing on the Console which implies the script didn't even start. $\endgroup$
    – Arklur
    Jan 29, 2018 at 8:03
  • $\begingroup$ Why is that the starting point? what is RUNCODE $\endgroup$
    – batFINGER
    Jan 29, 2018 at 8:16
  • $\begingroup$ Oh yes, sorry. That's just an enum. $\endgroup$
    – Arklur
    Jan 29, 2018 at 8:30
  • $\begingroup$ I see nothing in that code that will hang blender. How are you running this script. If run via "run script" operator, __name__ == "__main__" if autorun via registered script __name__ will be the module name, hence the if will never be true. $\endgroup$
    – batFINGER
    Jan 29, 2018 at 14:54

1 Answer 1


Apparently I had (have) to press Enter (any key?) in the Console window, but I don't know why...but it's a "solution" at least. If someone knows what can cause this, please feel free to write a post/comment.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .