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

Debug multiprocess leads to AttributeError Can't get attribute on <module '__main__ #2108

@GoranDubajic

Description

@GoranDubajic

Environment data

  • VS Code version: Version: 1.42.1 (user setup)
    Commit: c47d83b293181d9be64f27ff093689e8e7aed054
    Date: 2020-02-11T14:45:59.656Z
    Electron: 6.1.6
    Chrome: 76.0.3809.146
    Node.js: 12.4.0
    V8: 7.6.303.31-electron.0
    OS: Windows_NT x64 10.0.18363
  • Extension version (available under the Extensions sidebar): 2020.2.64397
  • OS and version: Windows_NT x64 10.0.18363
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.1, it reproduces for other versions as well.
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: N/A
  • Relevant/affected Python-related VS Code extensions and their versions: N/A
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version vscode-python#3977): true
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

Script should debug without any exception.

Actual behaviour

Exception at line 14 for the script bellow.

Exception has occurred: AttributeError
Can't get attribute 'Foo' on <module '__main__' from 'c:\\Users\\gorand\\.vscode\\extensions\\ms-python.python-2020.2.64397\\pythonFiles\\lib\\python\\new_ptvsd\\no_wheels\\ptvsd\\__main__.py'>
  File "E:\git\VSOGD\Misc\Python\mp_queue_example.py", line 14, in <module>
    print(q.get().value)    # prints 1

Steps to reproduce:

Debug this script.

from multiprocessing import Process, Queue

class Foo:
    def __init__(self, value):
        self.value = value

def f(q):
    q.put(Foo(1))

if __name__ == '__main__':
    q = Queue()
    p = Process(target=f, args=(q,))
    p.start()
    print(q.get().value)    # prints 1
    p.join()

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions