0

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)
gandalf3
  • 157,169
  • 58
  • 601
  • 1,133
Gilles
  • 121
  • 2
  • 7

1 Answers1

4

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"
Flavio
  • 453
  • 3
  • 12