import sys from pathlib import Path from .error import InterpreterError def load_file_path(arg: str) -> Path: """load given argument.""" try: index = int(arg.split(':')[1]) except ValueError: raise InterpreterError('Invalid argument index') except IndexError: return Path(arg).resolve() return Path(sys.argv[2 + index])