0
$\begingroup$

I am trying to start and run a blend file with python3 popen under windows 7, but all I am able to do is start Blender.

blendFile = "D:\_Blender_Files\atrium.blend"
blenderPath = r"C:\Program Files\Blender Foundation\blender-2.71-windows64\blender.exe"
subprocess.Popen([blenderPath, blendFile], stdout=subprocess.PIPE)
$\endgroup$
  • 1
    $\begingroup$ closing, the issue with slash direction is a common beginner mistake, and not specific to Blender. $\endgroup$ – ideasman42 Jul 15 '14 at 23:23
4
$\begingroup$

It's because of the escape character "\" and how python handles it. Windows paths on python scripts are a nightmare. So you have to escape the backslash.

Try :

blendFile = "D:\\_Blender_Files\\atrium.blend"
blenderPath = r"C:\\Program Files\\Blender Foundation\\blender-2.71-windows64\\blender.exe"
subprocess.Popen([blenderPath, blendFile], stdout=subprocess.PIPE)

or with simple slashes (python handles it well) :

blendFile = "D:/_Blender_Files/atrium.blend"
| improve this answer | |
$\endgroup$
  • $\begingroup$ Dang, you hit the nail, thank You for the fast reply! $\endgroup$ – Gilles Jul 15 '14 at 13:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.