-
Notifications
You must be signed in to change notification settings - Fork 27
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
builtin modules have no __file__ attribute? #302
Comments
"Interesting" - the main difference between CSnakes CAPI and pythonnet's PythonEngine is how the PYTHONPATH is set. After Py_InitializeEx pytonnet changes sys.path on the module. the builtin modules have CSnake does a Py_SetPath before Py_Initalize . the builtin do not have By changing runtime.cs to
and adding the virtuel environment path to the sys module like:
CSnakes works correctly. Maybe its a bug in the nuget python package (3.12.7) ... PS: please think about making the whole CAPI stuff public. My branch of CSnakes does so and without it would be a hard task writing and testing such changes... . Maybe there is some C# magic which enables to use it as public and those who are more concerned just have APIs above and such can not do "unsafe" stuff... |
The code in the pull request append the missing paths from PytonPath to sys.path . This way the CPython's default remain untouched and in order. Maybe the DLL implementors did the right thing... |
Python code like
fails as there is no
__file__
set.Don't know why - in pythonnet the attribute is created on the builtin modules...
The text was updated successfully, but these errors were encountered: