0
$\begingroup$

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):
    GRAPHVIZ_FILES = 0
    WAVEFRONT_OBJECT = 1
    EXTRACT_COORDINATES = 2
    GENERATE_CONNNECTIONS = 3
    REINITIALIZE_SCENE = 4
    IMPORT_OBJ_FILE = 5
    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?

$\endgroup$
6
  • $\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

0
$\begingroup$

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.

$\endgroup$

You must log in to answer this question.

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