code: def extract(args):
      try:
          client = carla.Client(args.host, args.port, worker_threads=1)
          client.set_timeout(2.0)
  
          world = client.get_world()
          try:
              _map = world.get_map()
          except RuntimeError as error:
              logging.info("RuntimeError: %s", error)
              sys.exit(1)
  
          if not _map.get_spawn_points():
              logging.info(
                  "There are no spawn points available in your map/town."
              )
              logging.info(
                  "Please add some Vehicle Spawn Point to your UE4 scene."
              )
              sys.exit(1)
          spawn_points = _map.get_spawn_points()
          with open(
              args.output_dir + "/spawn_points.csv",
              "w",
              encoding="utf8",
          ) as file:
              index = 0
              for index, spawn_point in enumerate(spawn_points):
                  file.write(
                      f"{index},{spawn_point.location.x},{spawn_point.location.y},{spawn_point.location.z}\n"
                  )
  
      finally:
          world = None
  
file_path: carla/PythonAPI/util/extract_spawn_points.py
imports: from __future__ import print_function
  import argparse
  import logging
  import glob
  import os
  import sys
  import carla
label_desc: Use image node_id 1 for calling a global function with example usage: extract(args) without return types