Why do I get such an error? if on ubuntu/apache in the OpenSSH client all this works

module 'clr' has no attribute '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'

in openSSH client all work it:

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

in openSSH client all work it: in django website no:

pip uninstall clr

pip uninstall pythonnet

pip install pythonnet

module 'clr' has no attribute 'AddReference'

Back to Top