Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does debugpy still support Jython? #754

Closed
doggnol opened this issue Oct 14, 2021 · 1 comment
Closed

Does debugpy still support Jython? #754

doggnol opened this issue Oct 14, 2021 · 1 comment

Comments

@doggnol
Copy link

doggnol commented Oct 14, 2021

Environment data

  • debugpy version: 1.5.0
  • OS and version: WIN10
  • Python version (& distribution if applicable, e.g. Anaconda): Jython 2.7.2
  • Using VS Code or Visual Studio: VS Code

Actual behavior

I was trying to debug jython program using vs code.
My plan is to start a debug server using debugpy, and launch vs code debug session in 'attach to' mode.
Codes are like:

def hello_world():
    print('hello world')

if __name__ == '__main__':
    hello_world()

And I started debug server using:

D:\software\jython\bin\jython.exe -m debugpy --listen localhost:5678 --wait-for-client .\main.py

Then just got an attribute error:

D:\software\jython\bin\jython.exe -m debugpy --listen localhost:5678 --wait-for-client .\main.py
  File "D:\software\jython\Lib\runpy.py", line 161, in _run_module_as_main
  File "D:\software\jython\Lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "D:\software\jython\Lib\site-packages\debugpy\__main__.py", line 43, in <module>
  File "D:\software\jython\Lib\site-packages\debugpy\server\__init__.py", line 9, in <module>
    import debugpy._vendored.force_pydevd  # noqa
  File "D:\software\jython\Lib\site-packages\debugpy\_vendored\force_pydevd.py", line 37, in <module>
    pydevd_constants = import_module('_pydevd_bundle.pydevd_constants')
  File "D:\software\jython\Lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
  File "D:\software\jython\Lib\site-packages\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_constants.py", line 365, in <module>
    from _pydev_imps._pydev_saved_modules import thread, threading
  File "D:\software\jython\Lib\site-packages\debugpy\_vendored\pydevd\_pydev_imps\_pydev_saved_modules.py", line 97, in <module>
    import thread;    verify_shadowed.check(thread, ['start_new_thread', 'start_new', 'allocate_lock'])
  File "D:\software\jython\Lib\site-packages\debugpy\_vendored\pydevd\_pydev_imps\_pydev_saved_modules.py", line 73, in check
    msg = self._generate_shadowed_import_message([module.__file__])
AttributeError: type object 'org.python.modules.thread.thread' has no attribute '__file__'

I don't know if debugpy has loaded correct 'thread' module.
Or debugpy is no longer supported for Jython.

@fabioz
Copy link
Collaborator

fabioz commented Oct 14, 2021

Well, Jython was never officially supported in debugpy (it was never in the debugpy ci and it was removed from the pydevd ci some time ago).

Having said that, the support for Jython wasn't really removed from the debugger and if interested users do provide fixes those are applied.

i.e.: the fix from fabioz/Pydev@ac17851 is being ported to debugpy in #755, so, it may work again in a future release (you may also remove the start_new in your local version of _pydev_saved_modules.py to have it working)...

Now, it's possible that support for Python 2.7 is completely removed sometime, in this case, Jython won't be supported at all anymore as it doesn't really have a 3.x release.

@fabioz fabioz closed this as completed Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants