-
Notifications
You must be signed in to change notification settings - Fork 756
Closed
Description
my environment:
- python 3.13
- .net: 8
- win 10
my c# test code is:
using (Py.GIL())
{
dynamic socket = Py.Import("socket");
_messageService.Message($"socket.SO_KEEPALIVE: {socket.SO_KEEPALIVE}"); // 8
try
{
var tcp_keepidle = socket.TCP_KEEPIDLE;
}
catch (Exception e)
{
Console.WriteLine($"socket.TCP_KEEPIDLE error: {e.Message}");
}
}
My question is why it raise exception in var tcp_keepidle = socket.TCP_KEEPIDLE
, which shows error socket.TCP_KEEPIDLE error: The module has no attribute 'TCP_KEEPIDLE'
.
but if I test in ipython, there is no error here in getting socket.TCP_KEEPIDLE
my python environment setting is
string py_path = Path.Combine(XSPkgPythonPath) + Path.PathSeparator.ToString(); // my local python packages
py_path += Path.Combine(PythonEmbededPath, "DLLs") + Path.PathSeparator.ToString();
py_path += Path.Combine(PythonEmbededPath, "Lib") + Path.PathSeparator.ToString();
py_path += PythonEmbededPath + Path.PathSeparator.ToString();
py_path += Path.Combine(PythonEmbededPath, "Lib", "site-packages") + Path.PathSeparator.ToString();
py_path += Path.Combine(PythonEmbededPath, "Lib", "site-packages", "win32") + Path.PathSeparator.ToString();
py_path += Path.Combine(PythonEmbededPath, "Lib", "site-packages", "win32", "lib") + Path.PathSeparator.ToString();
py_path += Path.Combine(PythonEmbededPath, "Lib", "site-packages", "pythonwin");
Runtime.PythonDLL = Path.Combine(PythonEmbededPath, "python313.dll");
PythonEngine.PythonHome = PythonEmbededPath;
PythonEngine.PythonPath = py_path;
PthonEngine.Initialize();
PythonEngine.BeginAllowThreads();
Metadata
Metadata
Assignees
Labels
No labels