Launch blender in background mode with a python script. --python= doesn’t work

Hello,

I want to launch a scene and a script in command line.
But each time the --python=“blabla.py” is interpreted by blender like this /path/current/–python=“blabla.py”

Here the log:

X:\Directory>"C:/Program Files/Blender Foundation/Blender 2.93/blender" --background "X:/Directory/blabla.blend" --python="X:/Directory/parameters_test.py"
Blender 2.93.1 (hash 1b8d33b18c2f built 2021-06-22 23:47:42)
Read prefs: C:\Users\Toto\AppData\Roaming\Blender Foundation\Blender\2.93\config\userpref.blend
module changed on disk: 'C:\\Program Files\\Blender Foundation\\Blender 2.93\\2.93\\scripts\\addons\\object_print3d_utils\\__init__.py' reloading...
loading in background
<bpy_struct, WindowManager("WinMan") at 0x00000150598BCF08>
default 'Scripting' workspace needed for POV centric Workspace
Read blend: X:/Directory/blabla.blend
loading in background
<bpy_struct, WindowManager("WinMan") at 0x00000150598BCF08>
default 'Scripting' workspace needed for POV centric Workspace
unknown argument, loading as file: --python=X:/Directory/parameters_test.py
Erreur: Impossible de lire le fichier "X:\Directory\--python=X:/Directory/parameters_test.py" : Invalid argument

Blender quit

I think the problem comes from here:

<bpy_struct, WindowManager("WinMan") at 0x00000150598BCF08>
default 'Scripting' workspace needed for POV centric Workspace

But I could not find anything about this error.

Any idea?

That’s not how commandline arguments are given. Get rid of the =
blender -b --python {script_path}

The first line isn’t an error. It just an object and its memory address. Some other script is executing.
Second line is a user created print statement of some kind rather than an execution error.
Probably from an addon?

This is the error. You can tell because it says Erreur. It’s reporting that it’s trying to interpret the bad argument as a file which it obviously can’t do.

1 Like

Without the ’=’ it’s works.

Thank you init_pixel.