IronLanguages / ironpython3

Implementation of Python 3.x for .NET Framework that is built on top of the Dynamic Language Runtime.
Apache License 2.0
2.43k stars 283 forks source link

Using IronPython shell from GNU Emacs doesn't work #1753

Open programingfrik opened 7 months ago

programingfrik commented 7 months ago

Prerequisites

Confirmed is an error not a question.

Description

I'm triying to run IronPython 3.4.1 (ipy.exe) as my python interpreter inside GNU Emacs 28.2 (build 2, x86_64-w64-mingw32), but it doesn't work. The original cpython interpreter, from the cygwin package, does work, ironpython 3.0.0 from the mono project installer also works.

Steps to Reproduce

To reproduce this error:

  1. Run GNU Emacs 28.2 having the python-mode 20221008.1936 installed.
  2. Run the M-x customize command and search for the Python Shell Interpreter variable.
  3. Put the ipy.exe full path on the variable and save it for the current session and future sessions.
  4. Run the M-x run-python command to ask emacs for a python shell.

Expected behavior:

It should show the ironpython shell and let me work on it as an older version that comes from the mono project does: image

Or as the cpython interpreter that comes from cygwin does: image

Actual behavior:

Emacs tries to execute the interpreter but enters on some kind of infinite loop repeating "OSError: [Errno 9] The handle is invalid." until it is stopped either through the task manager or via the C-c C-c key combo: image

Also i don't understand why emacs opens 2 sub-process of ironpython, maybe related to the error: image

Version Information

Result of ipy -VV:

$ ipy -VV
IronPython 3.4.1 (3.4.1.1000)
[.NETFramework,Version=v4.6.2 on .NET Framework 4.8.4645.0 (64-bit)]

.NET platform used:

$ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.302
 Commit:    c857713418

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19044
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.302\

global.json file:
  Not found

Host:
  Version:      6.0.7
  Architecture: x64
  Commit:       0ec02c8c96

.NET SDKs installed:
  5.0.416 [C:\Program Files\dotnet\sdk]
  6.0.302 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspN
etCore.App]
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspN
etCore.App]
  Microsoft.AspNetCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.App]
  Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore
.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore
.App]
  Microsoft.NETCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
  Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.
WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.
WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.W
indowsDesktop.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

Operating system used: Windows 10 Professional Version 21H2 OS build 19044.3324

sys.version:

$ ipy
IronPython 3.4.1 (3.4.1.1000)
[.NETFramework,Version=v4.6.2 on .NET Framework 4.8.4645.0 (64-bit)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version
'3.4.1 (3.4.1.1000)\n[.NETFramework,Version=v4.6.2 on .NET Framework 4.8.4645.0
(64-bit)]'

As I'm comparing against the ironpython 3.0.0 that comes with mono here I include the version:

$ mono --version
Mono JIT compiler version 6.12.0 (Visual Studio built mono)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-proj
ect.com
        TLS:           __thread
        SIGSEGV:       normal
        Notification:  Thread + polling
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        Interpreter:   yes
        LLVM:          supported, not enabled.
        Suspend:       preemptive
        GC:            sgen (concurrent by default)

Also I'm comparing against the cpython interpreter from cygwin, here I include the cygwin version:

$ uname -a
CYGWIN_NT-10.0-19044 DTI-6005-66 3.3.6-341.x86_64 2022-09-05 11:15 UTC x86_64 Cygwin
slozier commented 7 months ago

I think the error is probably the same as launching with the VS Code internal console.