I have to start a postgresql server when blender starts. To start the server I use a .bat file I start manually.

I want to automatically start the server (execute the .bat) when Blender starts. I tried this script but it not working. ideas?

import subprocess
p = subprocess.Popen(filepath, shell=True, stdout = subprocess.PIPE)
stdout, stderr = p.communicate()
  • $\begingroup$ Dont you need double slashes or forward slash? c:\\folder\\file or c:/folder/file $\endgroup$ – Stig Atle Steffensen Jul 9 '15 at 14:55
  • $\begingroup$ When I use \\ or / and I execute the script, Blender not responding! $\endgroup$ – logiquefloue Jul 9 '15 at 15:06
  • $\begingroup$ do you start it and let it run in the background? check if postgresql has started. check this question for starting a process and letting it run in the background. stackoverflow.com/questions/1196074/… $\endgroup$ – Stig Atle Steffensen Jul 9 '15 at 15:12

Would it not be simpler to start both blender and postgresql using the same .bat file. Then point any blender shourtcuts/links you have at that file?

  • $\begingroup$ How can I start postgresql since all .blend files? $\endgroup$ – logiquefloue Jul 9 '15 at 14:32

I answer my question. Here is a code that works for me:

import bpy
import os

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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