You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Probably doing something wrong here, but no idea what.
This is the Python code (this is a copy-paste of the code variable from the C# code below, as viewed in the Visual Studio watch window, if that matters):
# encoding: UTF-8
import io
with io.open("phi.txt", "r", encoding="utf-8") as f:
phi = f.read()
if phi != "φ":
raise RuntimeError(f"Expected 'φ' but got '{phi}'")
This is phi.txt (no newline):
φ
Running this with CPython 3.8 outputs nothing as expected. Running this via pythonnet_py_38_win v2.5.2 using the same Python distribution
using( Py.GIL() )
{
var scope = Py.CreateScope();
var script = "/path/to/phi.py";
var code = File.ReadAllText( script, Encoding.UTF8 );
scope.Execute( PythonEngine.Compile( code, script, RunFlagType.File ) );
}
results in a PythonException: {"RuntimeError : Expected 'f' but got 'φ'"}. What would be going on here?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Probably doing something wrong here, but no idea what.
This is the Python code (this is a copy-paste of the
codevariable from the C# code below, as viewed in the Visual Studio watch window, if that matters):This is phi.txt (no newline):
Running this with CPython 3.8 outputs nothing as expected. Running this via pythonnet_py_38_win v2.5.2 using the same Python distribution
results in a
PythonException:{"RuntimeError : Expected 'f' but got 'φ'"}. What would be going on here?All reactions