Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Generated code often leads to source unavailable #1398

Closed
karthiknadig opened this issue May 2, 2019 · 4 comments
Closed

Generated code often leads to source unavailable #1398

karthiknadig opened this issue May 2, 2019 · 4 comments
Labels

Comments

@karthiknadig
Copy link
Member

Minimal repro, step into, with "justMyCode: true"

import unittest
@Zrincet
Copy link

Zrincet commented Jun 8, 2019

When I used requests.get(), the program ended unexpectedly. I tried to debug at this location and then showed ‘Could not load source '<string>': Source unavailable. ’, the call stack was '__new__'

@int19h
Copy link
Contributor

int19h commented Jun 8, 2019

@Zrincet, when you get that message, your program is paused normally, it just means that it's inside code for which there's no source. Usually this means that something is doing exec or eval, but sometimes it's dynamically generated functions. In this particular case, it's namedtuple.__new__ that is generated for some tuple used internally by the library you're calling.

You can press F5 to continue running as usual, or even step in/over/out (although you won't see where you're stepping through, until you reach code with source again).

@Zrincet
Copy link

Zrincet commented Jun 10, 2019

@int19h , If I breakpoints at requests.get(), the program will not continue to run while debugging. The program was closed unexpectedly without any prompts. I thought the problem was with my code, but in the end I found out that it was because of a breakpoint at requests.get(). If the statement following the requests.get() breakpoints, debugging will not go wrong.

@int19h
Copy link
Contributor

int19h commented Jun 10, 2019

@Zrincet, got it! Can you please do this in your launch config:

"env": {
  ...
  "PTVSD_LOG_DIR": "<directory-to store-logs>",
},

and share the logs that it places there? You'll have to create the directory first, and there may be more than one log if you're running Flask with reloading enabled (it creates one log per process).

If there's any private information in your environment, check the logs first. There's stuff there like pathnames etc that might expose your username, for example. And it also logs all protocol messages, so any private data in the app you're running could also be exposed via Variable Explorer. None of that is relevant for us to diagnose this particular problem.

Also, since not continuing to run properly is a distinct problem from the one this issue covers, can you please open as separate issue, and put the logs there?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants