我已經(jīng)開始使用 Visual Studio 代碼進行遠程調(diào)試,但我無法讓它工作。遠程和本地開發(fā) PC 都運行 4.1.3 版 ptvsd。遠程機器有腳本:import ptvsdptvsd.enable_attach()#Enable the below line of code only if you want the application to wait untill the debugger has att$#ptvsd.wait_for_attach()import randomguesses_made = 0name = input('Hello! What is your name?\n')number = random.randint(1, 20)print('Well, {0}, I am thinking of a number between 1 and 20.'.format(name))while guesses_made < 6: guess = int(input('Take a guess: ')) guesses_made += 1 if guess < number: print('Your guess is too low.') if guess > number: print('Your guess is too high.') if guess == number: breakif guess == number: print('Good job, {0}! You guessed my number in {1} guesses!'.format(name, guesses_made))else: print('Nope. The number I was thinking of was {0}'.format(number))本地計算機是:import ptvsdptvsd.enable_attach(address = ('192.34.98.197',3000))#Enable the below line of code only if you want the application to wait untill the debugger has attached to it#ptvsd.wait_for_attach()import randomguesses_made = 0name = input('Hello! What is your name?\n')number = random.randint(1, 20)print('Well, {0}, I am thinking of a number between 1 and 20.'.format(name))while guesses_made < 6: guess = int(input('Take a guess: ')) guesses_made += 1 if guess < number: print('Your guess is too low.') if guess > number: print('Your guess is too high.') if guess == number: breakif guess == number: print('Good job, {0}! You guessed my number in {1} guesses!'.format(name, guesses_made))else: print('Nope. The number I was thinking of was {0}'.format(number))我已將條目添加到 launch.json 中:{ "name": "Attach (Remote Debug)", "type": "python", "request": "attach", "localRoot": "${workspaceRoot}", "remoteRoot": "/home/pi/testdebug/", "port": 3000, "secret": "my_secret", "host":"localhost"},
添加回答
舉報
0/150
提交
取消