microsoft / PTVS

Python Tools for Visual Studio
https://aka.ms/PTVS
Apache License 2.0
2.52k stars 673 forks source link

Getting Thread Error While Executing Python Code :: In other debugger or without debugging its run smooth #7926

Open vsfeedback opened 2 weeks ago

vsfeedback commented 2 weeks ago

This issue has been moved from a ticket on Developer Community.


[regression] Traceback (most recent call last): File "C:\Users\jaydu\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 198, in _run_module_as_main return _run_code(code, main_globals, None, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jaydu\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 88, in _run_code exec(code, run_globals) File "c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\debugpy\adapter/../..\debugpy\launcher/../..\debugpy__main.py", line 39, in cli.main() File "c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430, in main run() File "c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 268, in run_file start_debugging(target) File "c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 258, in start_debugging debugpy.connect(options.address, access_token=options.adapter_access_token) File "c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\public_api.py", line 31, in wrapper return wrapped(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\api.py", line 143, in debug log.reraise_exception("{0}() failed:", func.name__, level="info") File "c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\api.py", line 141, in debug return func(address, settrace_kwargs, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\api.py", line 297, in connect _settrace(host=host, port=port, client_access_token=access_token, settrace_kwargs) File "c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\api.py", line 45, in _settrace return pydevd.settrace(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\debugpy_vendored\pydevd\pydevd.py", line 2821, in settrace _locked_settrace( File "c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\debugpy_vendored\pydevd\pydevd.py", line 2942, in _locked_settrace py_db.patch_threads() File "c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\debugpy_vendored\pydevd\pydevd.py", line 2392, in patch_threads patch_thread_modules() File "c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\debugpy_vendored\pydevd_pydev_bundle\pydev_monkey.py", line 1205, in patch_thread_modules patch_thread_module(t) File "c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\debugpy_vendored\pydevd_pydev_bundle\pydev_monkey.py", line 1168, in patch_thread_module _original_start_new_thread = thread_module._original_start_new_thread = thread_module.start_new_thread ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'thread' has no attribute 'start_new_thread' The program 'python.exe' has exited with code 4294967295 (0xffffffff).


Original Comments

Nicole Hu [MSFT] on 6/2/2024, 07:58 PM:

(private comment, text removed)

Feedback Bot on 6/2/2024, 08:12 PM:

(private comment, text removed)

Graham Wheeler [MSFT] on 6/12/2024, 08:45 AM:

(private comment, text removed)


Original Solutions

(no solutions)

StellaHuang95 commented 2 weeks ago

Can you try the solution mentioned in the original post and let us know if it doesn't work? https://stackoverflow.com/questions/78090632/attributeerror-module-thread-has-no-attribute-start-new-thread