microsoft / microsoft/vscode-python-web-wasm

`ModuleNotFoundError` when debugging files in workspace subdirectory

Offen
#46 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
100
Forks
15
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Code Snippet

src/declare.py
def func():
    return "success"
src/consume.py
from declare import func

print(func())

Repro Steps

  1. Create files as above. Note that they are in the src subdirectory of the workspace.
  2. Open workspace root (parent of src) in https://insiders.vscode.dev/?vscode-coi=
  3. Open consume.py
  4. "Run Python File in WASM"
  5. Note that "success" is printed in the program output (Terminal pane)
  6. "Debug Python File in WASM"
  7. When debugger stops at top of file, press the "Continue" button in the debugging toolbar.

Expected behavior

Code runs successfully again and prints "success" in the program output (Debug Console pane)

Actual behavior

No "success" in program output. "Debug Console" shows the errors below. I think the "Bad file descriptor" may be a known issue, but note the ModuleNotFoundError.

If you move the two files from src to the workpace root, the code works as expected while debugging.

On desktop the code works as expected with the files in either location.

PDB debugger connected.
Traceback (most recent call last):
  File "/$debug/main.py", line 12, in run
    dbg._run(tgt)
  File "/lib/python3.11/pdb.py", line 1646, in _run
    self.run(target.code)
  File "/lib/python3.11/bdb.py", line 597, in run
    exec(cmd, globals, locals)
  File "<string>", line 1, in <module>
  File "/workspace/src/consume.py", line 1, in <module>
    from declare import func
ModuleNotFoundError: No module named 'declare'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/$debug/main.py", line 31, in <module>
    run(debugger, target)
  File "/$debug/main.py", line 25, in run
    dbg.interaction(None, t)
  File "/lib/python3.11/pdb.py", line 434, in interaction
    self.print_stack_entry(self.stack[self.curindex])
  File "/lib/python3.11/pdb.py", line 1553, in print_stack_entry
    self.message(prefix +
  File "/lib/python3.11/pdb.py", line 535, in message
    print(msg, file=self.stdout)
OSError: [Errno 8] Bad file descriptor

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere den Fehler mit src/declare.py und src/consume.py, indem du “Debug Python File in WASM” verwendest, nachdem du es mit “Run Python File in WASM” verglichen hast. Beginne damit, den Debugger-Einstiegspunkt für Workspace-Unterverzeichnisse und den gemeldeten ModuleNotFoundError nachzuverfolgen; abgeschlossen ist die Aufgabe, wenn das Debugging im Debug Console „success“ ausgibt, ohne Import- oder Descriptor-Fehler.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, wasm
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.