# Fix blender path import os import sys from argparse import ArgumentParser sys.path.append(os.path.expanduser("~/.local/lib/python3.9/site-packages")) # Monkey patch argparse such that # blender / python parsing works def parse_args(self, args=None, namespace=None): if args is not None: return self.parse_args_bak(args=args, namespace=namespace) try: idx = sys.argv.index("--") args = sys.argv[idx + 1:] # the list after '--' except ValueError as e: # '--' not in the list: args = [] return self.parse_args_bak(args=args, namespace=namespace) setattr(ArgumentParser, 'parse_args_bak', ArgumentParser.parse_args) setattr(ArgumentParser, 'parse_args', parse_args)