profile
viewpoint

Ask questionsValueError: signal only works in main thread

Environment data

  • PTVSD version: 4.3.0
  • OS and version: Raspbian Strech (Debian 9.8)
  • Python version (& distribution if applicable, e.g. Anaconda): 3.5.3
  • Using VS Code or Visual Studio: VS Code (THEIA IDE)

Actual behavior

In a module I add

import ptvsd
ptvsd.enable_attach()

but when loading the module I get ValueError: signal only works in main thread

Full traceback when loading module:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/mycroft/skills/core.py", line 131, in load_skill
    imp.PY_SOURCE))
  File "/usr/lib/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/usr/lib/python3.5/imp.py", line 170, in load_source
    module = _exec(spec, sys.modules[name])
  File "<frozen importlib._bootstrap>", line 626, in _exec
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/opt/mycroft/skills/count-skill/__init__.py", line 22, in <module>
    ptvsd.enable_attach()
  File "/home/pi/mycroft-core/.venv/lib/python3.5/site-packages/ptvsd/attach_server.py", line 101, in enable_attach
    ptvsd_enable_attach(address)
  File "/home/pi/mycroft-core/.venv/lib/python3.5/site-packages/ptvsd/_remote.py", line 64, in enable_attach
    **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.5/site-packages/ptvsd/pydevd_hooks.py", line 128, in install
    daemon = Daemon(**kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.5/site-packages/ptvsd/daemon.py", line 503, in __init__
    super(Daemon, self).__init__(wait_for_user, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.5/site-packages/ptvsd/daemon.py", line 100, in __init__
    self._install_exit_handlers()
  File "/home/pi/mycroft-core/.venv/lib/python3.5/site-packages/ptvsd/daemon.py", line 425, in _install_exit_handlers
    self._exithandlers.install()
  File "/home/pi/mycroft-core/.venv/lib/python3.5/site-packages/ptvsd/exit_handlers.py", line 62, in install
    self._install_signal_handler()
  File "/home/pi/mycroft-core/.venv/lib/python3.5/site-packages/ptvsd/exit_handlers.py", line 103, in _install_signal_handler
    orig[sig] = signal.signal(sig, self._signal_handler)
  File "/usr/lib/python3.5/signal.py", line 47, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread

Expected behavior

I would expect that a debug server were started so I could attach to that

microsoft/ptvsd

Answer questions andaag

Eny eta on getting this on master? I'm hitting this in the linked issue.

useful!
source:https://uonfu.com/
Github User Rank List