Question
Ivan Tioh · Apr 5, 2017

[Python-Cache Binding] DLL load failed when trying to import intersys.pythonbind3 using $zf(-1)

I have done Python - Cache binding setup following the guide from http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=.... I have also run test.py from sample3 folder and it able to run and complete successfully.

However, when I try to run the same test.py code via $zf, it gives error with exit code 1.

I've tried running help("intersys.pythonbind3") via $zf and also running from Cache terminal as follows:

  1. $zf(-1,"C:\Python36\python <path>/script.py")
  2. ! C:\Python36\python <path>/script.py

which gives me the following output:

problem in intersys.pythonbind3 - ImportError: DLL load failed: The specified module could not be found.

But running the above directly from command prompt is fine.

Any ideas on this ImportError?

Regards,

Ivan

00
0 0 6 474
Log in or sign up to continue

Replies

Why are you running script connecting to Caché from Caché?

Basically, I am trying to do some processing in Python when certain action is triggered from frontend CSP, and then return output back up to interface.

You can output to current device, and read that in Caché. Here's a relevant discussion.

Thank you for your comment. I have no issue with reading the output. The problem I have is regarding the DLL error. From what I understand, $zf invokes OS shell which should be equivalent to CMD. So why is running same script via these 2 approaches give 1 success 1 error. Am I missing some configurations/parameters for $zf?

You're trying to connect to cache from the same cache process. I think the error arises from that.

In case anyone else facing the same issue and for future reference, I include here with my workaround for the error here.

I managed to solve it by referring to this forum (Link: http://www.progtown.com/post37004192.html#p37004192)

I have simply done the following:

Copy all DLL from folder <cachesys>\dev\cpp\lib to <python installation path>\Lib\site-packages\intersys

Although I not sure whether how legit is this solution, but this is currently a logical and plausible workaround for the problem I faced here.

Regards,

Ivan