Hello Paul,
I came across the same issue mentioned in this post, also using Python 3.3 in Win7-64bit.
sam.nrel.gov/content/sscdll-python-error
OSError: [WinError 126] The specified module could not be found.
I tried several approachs, none except placing the script and the
dll in the same folder worked.
Checking for the files is True both times:
print(os.path.isfile("C:/temp/sam-sdk-2014-11-24/win64/ssc.dll"))
True
print(os.path.isfile("../../win64/ssc.dll"))
True
Loading the CDLL fails both times:
self.pdll = CDLL("../../win64/ssc.dll")
OSError: [WinError 126] The specified module could not be found.
self.pdll = CDLL("C:/temp/sam-sdk-2014-11-24/win64/ssc.dll")
OSError: [WinError 126] The specified module could not be found.
putting the py script in the same directory as the dll and using
self.pdll = cdll.LoadLibrary("ssc.dll")
works.
Also does changing Python's current working directory to the folder with the ssc.dll
Still strange...
After this was working I started porting the script to Python 3:
- replacing print with print()
- convert value to bytes: c_char_p(value) with c_char_p(value.encode()), due to the bytes-string-issue
- convert returned c_char_p to strings, e.g. t.decode('utf-8')
Step by step the script started working,
but there is an invalid character (no UTF-8) somewhere.
Using the simtest() fails while listing the input variable 'inv_snl_paco':
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x91 in position 19: invalid start byte
e.g. for 'inv_snl_c3' the printed result is
Input: 'inv_snl_c3' type(2) Empirical coefficient allowing Co to vary linearly with dc-voltage input, default value is zero, (1/V) (xxx)
It is not urgent, but if you could look into this and I get the script to work I could provide it to you.
I guess Python 3 will be the future, no matter what the 2.7 people tell :)
Another thing that should be fixed is the use of the variable name "type"
type = c_int()
in the script, which is a Python keyword.
Kind regards,
Joe