os.chdir(sys.argv[1])

port_num = int(sys.argv[2])
debug_id = sys.argv[3]
debug_options = vspd.parse_debug_options(sys.argv[4])
del sys.argv[0:5]

# set run_as mode appropriately
run_as = 'script'
if sys.argv and sys.argv[0] == '-m':
    run_as = 'module'
    del sys.argv[0]
if sys.argv and sys.argv[0] == '-c':
    run_as = 'code'
    del sys.argv[0]

# preserve filename before we del sys
filename = sys.argv[0]

# fix sys.path to be the script file dir
sys.path[0] = ''

# exclude ourselves from being debugged
vspd.DONT_DEBUG.append(os.path.normcase(__file__))

# remove all state we imported
del sys, os

# and start debugging
vspd.debug(filename, port_num, debug_id, debug_options, run_as)
os.chdir(sys.argv[1])

port_num = int(sys.argv[2])
debug_id = sys.argv[3]
debug_options = vspd.parse_debug_options(sys.argv[4])
del sys.argv[0:5]

# set run_as mode appropriately
run_as = 'script'
if sys.argv and sys.argv[0] == '-m':
    run_as = 'module'
    del sys.argv[0]
if sys.argv and sys.argv[0] == '-c':
    run_as = 'code'
    del sys.argv[0]

# preserve filename before we del sys
filename = sys.argv[0]

# fix sys.path to be the script file dir
sys.path[0] = ''

# exclude ourselves from being debugged
vspd.DONT_DEBUG.append(os.path.normcase(__file__))

# remove all state we imported
del sys, os

# and start debugging
vspd.debug(filename, port_num, debug_id, debug_options, run_as)
Пример #3
0
    if sys.argv and sys.argv[0] == '--' + opt.replace('_', '-'):
        globals()[opt] = True
        del sys.argv[0]

# set run_as mode appropriately
if sys.argv and sys.argv[0] == '-m':
    run_as = 'module'
    del sys.argv[0]

if sys.argv and sys.argv[0] == '-c':
    run_as = 'code'
    del sys.argv[0]

# preserve filename before we del sys
filename = sys.argv[0]

# fix sys.path to be the script file dir
sys.path[0] = ''

# exclude ourselves from being debugged
visualstudio_py_debugger.DONT_DEBUG.append(os.path.normcase(__file__))

# remove all state we imported
del sys, os

# and start debugging
visualstudio_py_debugger.debug(filename, port_num, debug_id, wait_on_exception,
                               redirect_output, wait_on_exit,
                               break_on_systemexit_zero, debug_stdlib,
                               django_debugging, run_as)
if sys.argv and sys.argv[0] == '-c':
    run_as = 'code'
    del sys.argv[0]

# preserve filename before we del sys
filename = sys.argv[0]

# fix sys.path to be the script file dir
sys.path[0] = ''

# exclude ourselves from being debugged
visualstudio_py_debugger.DONT_DEBUG.append(os.path.normcase(__file__))

# remove all state we imported
del sys, os

# and start debugging
visualstudio_py_debugger.debug(
    filename, 
    port_num, 
    debug_id, 
    wait_on_exception, 
    redirect_output, 
    wait_on_exit,
    break_on_systemexit_zero,
    debug_stdlib,
    django_debugging,
    run_as
)
Пример #5
0
    # set file appropriately, fix up sys.argv...
    
if len(sys.argv) >= 1 and sys.argv[0] == '--debug-stdlib':
    debug_stdlib = True
    del sys.argv[0]

if len(sys.argv) >= 1 and sys.argv[0] == '--django-debugging':
    django_debugging = True
    del sys.argv[0]

__file__ = sys.argv[0]

# fix sys.path to be the script file dir
sys.path[0] = os.path.split(sys.argv[0])[0]

# remove all state we imported
del sys, os

# and start debugging
visualstudio_py_debugger.debug(__file__, 
                                port_num, 
                                debug_id, 
                                globals(), 
                                locals(), 
                                wait_on_exception, 
                                redirect_output, 
                                wait_on_exit,
                                break_on_systemexit_zero,
                                debug_stdlib,
                                django_debugging)
Пример #6
0
def launch():
    import os
    import os.path
    import sys
    import traceback
    try:
        import visualstudio_py_debugger as vspd
    except:
        traceback.print_exc()
        print('''
    Internal error detected. Please copy the above traceback and report at
    http://go.microsoft.com/fwlink/?LinkId=293415

    Press Enter to close. . .''')
        try:
            raw_input()
        except NameError:
            input()
        sys.exit(1)

    # Arguments are:
    # 1. Working directory.
    # 2. VS debugger port to connect to.
    # 3. GUID for the debug session.
    # 4. Debug options (as integer - see enum PythonDebugOptions).
    # 5. '-m' or '-c' to override the default run-as mode. [optional]
    # 6. Startup script name.
    # 7. Script arguments.

    # change to directory we expected to start from
    os.chdir(sys.argv[1])

    port_num = int(sys.argv[2])
    debug_id = sys.argv[3]
    debug_options = vspd.parse_debug_options(sys.argv[4])
    del sys.argv[0:5]

    # set run_as mode appropriately
    run_as = 'script'
    if sys.argv and sys.argv[0] == '-m':
        run_as = 'module'
        del sys.argv[0]
    if sys.argv and sys.argv[0] == '-c':
        run_as = 'code'
        del sys.argv[0]

    # preserve filename before we del sys
    filename = sys.argv[0]

    # exclude ourselves from being debugged
    vspd.DONT_DEBUG.append(os.path.normcase(__file__))

    ## Begin modification by Don Jayamanne
    # Get current Process id to pass back to debugger
    currentPid = os.getpid()
    ## End Modification by Don Jayamanne

    # remove all state we imported
    del sys, os

    # and start debugging
    ## Begin modification by Don Jayamanne
    # Pass current Process id to pass back to debugger
    vspd.debug(filename, port_num, debug_id, debug_options, currentPid, run_as)
def launch():
    import os
    import os.path
    import sys
    import traceback
    try:
        import visualstudio_py_debugger as vspd
    except:
        traceback.print_exc()
        print('''
    Internal error detected. Please copy the above traceback and report at
    http://go.microsoft.com/fwlink/?LinkId=293415

    Press Enter to close. . .''')
        try:
            raw_input()
        except NameError:
            input()
        sys.exit(1)

    # Arguments are:
    # 1. Working directory.
    # 2. VS debugger port to connect to.
    # 3. GUID for the debug session.
    # 4. Debug options (as integer - see enum PythonDebugOptions).
    # 5. '-m' or '-c' to override the default run-as mode. [optional]
    # 6. Startup script name.
    # 7. Script arguments.

    # change to directory we expected to start from
    os.chdir(sys.argv[1])

    port_num = int(sys.argv[2])
    debug_id = sys.argv[3]
    debug_options = vspd.parse_debug_options(sys.argv[4])
    del sys.argv[0:5]

    # set run_as mode appropriately
    run_as = 'script'
    if sys.argv and sys.argv[0] == '-m':
        run_as = 'module'
        del sys.argv[0]
    if sys.argv and sys.argv[0] == '-c':
        run_as = 'code'
        del sys.argv[0]

    # preserve filename before we del sys
    filename = sys.argv[0]

    # exclude ourselves from being debugged
    vspd.DONT_DEBUG.append(os.path.normcase(__file__))

    ## Begin modification by Don Jayamanne
    # Get current Process id to pass back to debugger
    currentPid = os.getpid()
    ## End Modification by Don Jayamanne

    # remove all state we imported
    del sys, os

    # and start debugging
    ## Begin modification by Don Jayamanne
    # Pass current Process id to pass back to debugger
    vspd.debug(filename, port_num, debug_id, debug_options, currentPid, run_as)