donkirkby / live-py-plugin

Live coding in Python with PyCharm, Emacs, Sublime Text, or even a browser
https://donkirkby.github.io/live-py-plugin
MIT License
292 stars 56 forks source link

Feature request: Support for Python from WSL #321

Closed foldvari closed 1 year ago

foldvari commented 2 years ago

What I did

Describe the steps you took, probably including your Python code, like this:

I attempted to start live coding using Python interpreter  from WSL

What happened

Describe what you saw, probably including the live coding display, like this:

I got the below exception:
Live coding plugin exception:
com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "\\wsl$\Ubuntu-20.04\usr\bin\python" (in directory "C:\Users\xxxxx\AppData\Roaming\JetBrains\PyCharm2021.2\scratches"): CreateProcess error=1921, The name of the file cannot be resolved by the system

What I wanted to happen

Describe what you wanted, probably including changes to the live coding display, like this:

Live Coding works with Python in WSL.

My environment

Describe the versions of everything you were using:

donkirkby commented 1 year ago

I recreated the problem, and I've been digging through the IDEA source code to see if I can support WSL interpreters.

It looks like the PythonRunner class knows how to launch a WSL interpreter, but I haven't figured out how to pass it everything it needs. Maybe I can pass the command line patcher to the PythonRunner?

donkirkby commented 1 year ago

I posted a question about how to tweak the run configuration, to see if there's a more flexible way than I'm currently using.

I found it was useful to trace subprocesses in BaseProcessHandler.

donkirkby commented 1 year ago

After looking at how the PythonRunner class launches a WSL interpreter, I can't see any way to extend that class or use their code. It's too much code for me to reimplement, so I'm not going to support WSL interpreters. If I ever get an answer to my question or the PythonRunner class adds some extension points I can use, I'll reopen this issue.