0
$\begingroup$

I am struggling to find out the source of the segmentation fault I get when I try to load a file from a Python script (specifically a production shot of Charge). I try to call:

blender -b --python script.py

where the script contains:

import bpy
bpy.ops.wm.open_mainfile(filepath=path_to_file)

On the other hand, I can do:

blender -b path_to_file -o outfile

without issues.

I am honestly lacking an idea of what may cause this discrepancy.

$\endgroup$
5
  • 1
    $\begingroup$ I don't think it's possible to answer this with the information provided. If your question is about code, you have to share the code you are talking about if you want to get a meaningful answer. You should edit the question and provide the full information about the issue. $\endgroup$ Commented Apr 29 at 18:02
  • $\begingroup$ Or is it just that what you shared? How do you specify the path? $\endgroup$ Commented Apr 29 at 18:05
  • $\begingroup$ Yeah, literally just one line of opening the file from the script causes segfault, whereas the same file can be rendered through the command line interface. The path is the absolute path to the blend file. $\endgroup$
    – michal.1
    Commented Apr 30 at 9:14
  • $\begingroup$ Oh, then ironically, the only part of the code you run you changed in the question is where the answer probably is. You should always post the code you run unchanged. But I also suspect there is more, isn't there? What good is it to just load a scene in Blender started in background mode?.. $\endgroup$ Commented Apr 30 at 10:03
  • $\begingroup$ This whole secrecy about what you are actually doing when asking for help... I don't think it's very productive. :D $\endgroup$ Commented Apr 30 at 10:07

1 Answer 1

0
$\begingroup$

Command line and Python paths are written differently. "C:\some-file.blend" will work in command line, but Python string should be "C:\\some-file.blend" or r"C:\some-file.blend" so that the \ character is part of the string, because it alone is an escape character in Python.

$\endgroup$

You must log in to answer this question.

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