Почему я получаю такую ошибку? если на ubuntu/apache в клиенте OpenSSH все это работает
модуль 'clr' не имеет атрибута 'AddReference'
Traceback (most recent call last):
File "/home/djangoexample4/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/djangoexample4/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/djangoexample4/mainapp/views.py", line 135, in index
clr.AddReference('/home/djangoexample4/btclinux2/MyLibraryName/bin/Debug/net7.0/ubuntu.22.04-x64/MyLibraryName.dll')
Exception Type: AttributeError at /
Exception Value: module 'clr' has no attribute 'AddReference'
в клиенте openSSH все работает:
monop -r /home/djangoexample4/btclinux2/MyLibraryName/bin/Debug/net7.0/ubuntu.22.04-x64/MyLibraryName.dll
Assembly Information:
MyLibraryName
Version=1.0.0.0
Culture=neutral
PublicKeyToken=null
MyLibraryName.Class1
Total: 1 types.
namespace MyLibraryName{
public class Class1
{
public int method1()
{
return 777;
}
}
}
python3
>>>import clr
>>>clr.AddReference('/home/djangoexample4/btclinux2/MyLibraryName/bin/Debug/net7.0/ubuntu.22.04-x64/MyLibraryName.dll')
>>>from MyLibraryName import Class1
>>>variable = Class1().method1()
>>>print (variable)
777
в клиенте openSSH все работает: на сайте django нет:
pip uninstall clr
pip uninstall pythonnet
pip install pythonnet
модуль 'clr' не имеет атрибута 'AddReference'