MCPcopy Create free account
hub / github.com/microsoft/debugpy / run_file

Function run_file

src/debugpy/server/cli.py:343–361  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

341
342
343def run_file():
344 target = options.target
345 start_debugging(target)
346
347 # run_path has one difference with invoking Python from command-line:
348 # if the target is a file (rather than a directory), it does not add its
349 # parent directory to sys.path. Thus, importing other modules from the
350 # same directory is broken unless sys.path is patched here.
351
352 if target is not None and os.path.isfile(target):
353 dir = os.path.dirname(target)
354 sys.path.insert(0, dir)
355 else:
356 log.debug("Not a file: {0!r}", target)
357
358 log.describe_environment("Pre-launch environment:")
359
360 log.info("Running file {0!r}", target)
361 runpy.run_path(target, run_name="__main__")
362
363
364def run_module():

Callers

nothing calls this directly

Calls 2

start_debuggingFunction · 0.85
infoMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…