1

I'm trying to include a DLL into my python project but I'm having a terrible time.

I was following this thread: Accessing CPU temperature in python But I can't get the thing to import the file. I'm getting: Unable to import 'OpenHardwareMonitor'pylint(import-error)

I also placed the DLL into System32 folder and tried including it without the path with no luck. Any ideas?

Folder: OpenHardwareMonitorLib.dll Test.py

import clr #package pythonnet, not clr
import os
openhardwaremonitor_hwtypes = ['Mainboard','SuperIO','CPU','RAM','GpuNvidia','GpuAti','TBalancer','Heatmaster','HDD']


dir_path = os.path.dirname(os.path.realpath(__file__))

print ("Path:")
print (dir_path)
print ()

file = dir_path + "OpenHardwareMonitorLib.dll"

clr.AddReference(file)
from OpenHardwareMonitor import Hardware
Sarge324
  • 31
  • 7
  • same here: when the file is not present, got a short error: can't load, but when present, the error is the same but a longer one from System.Reflection.RuntimeAssembly._nLoad. Is a dependency needed? – Alexandre Mazel Mar 14 '23 at 09:07
  • The problem seems to be my python is 64bits but the dll is 32bits. – Alexandre Mazel Mar 14 '23 at 09:26

0 Answers0