-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting FAQ
Welcome to the pythonnet troubleshooting wiki on Windows!
If you get errors first things to check
Pythonnet consists of 2 DLLs: clr.pyd and Python.Runtime.dll, first DLL is used to embed .NET in CPython with import clr
statement and second DLL is used to embed CPython in .NET.
pip install pythonnet [--pre]
(--pre gets the latest development build uploaded to PyPI)
https://github.com/pythonnet/pythonnet/tree/master
Note that you need to have pip, six, wheel, setuptools installed. Also Windows SDK or Visual Studio (at least free version) need to be installed, since build process locates and uses msbuild.exe
and mt.exe
.
RGiesecke.DllExport does not support non English ILdasm generated IL file. You can inspect RGiesecke.DllExport with ilspy fixed it. Find and change "// Code" to you system language it in RGiesecke.DllExport.Parsing.Actions.DeleteExportAttributeParserAction.Execute
The correct set of compilation symbols are selected with UCS2 (UCS4 for Mono), x86 or x64 build of CPython and Python version flag (PYTHON27..PYTHON35).
Copy clr.pyd and Python.Runtime.DLL to PYTHONFOLDER\Lib\site-packages\
or include their location path to search paths
if GIT is installed:
pip install git+https://github.com/pythonnet/pythonnet -U
or from local pythonnet source directory:
python.exe setup.py bdist_wheel
at runtime or with environment variables.
And install this wheel:
pip install dist/*.whl
Where *.whl
is name of wheel in dist directory, that depends on Python version.
Note that pip install wheel
is requirement for building wheels.
Installed CPython is reachable by %PATH% or %PYTHONHOME% environment variables.
Pythonnet relies DLR and Hashset only added since CLR 4.0.
No left-over pythonnet assemblies in CPython folders or in GAC for CLR 2/4.
Make sure that all 3 WinForms demos are showing without errors:
helloform.py
splitter.py
wordpad.py
Make sure that all Python tests are passing locally by running this command
python pythonnet\src\tests\runtests.py
.
Note that Python.Test.dll needs to be copied to PYTHONFOLDER\Lib\site-packages\
.
You can also run NUnit
tests for embedding CPython in .NET using Python.EmbeddingTest.dll
.
https://pythonnet.github.io/readme.html
-
Report wrong result or exception and traceback
-
Report minimal reproducible exception or wrong result
When using .NET DLLs from pythonnet, analyze assembly binding errors using Fuslogvw.exe.
Check stackoverflow, mailing list archive, and past github issues:
http://stackoverflow.com/questions/tagged/python.net