Hello,
i'm trying to develop a dll that embeds python. I am using boost 1.72 and python 3.7
The dll exports some function to initialize python, adds some numpy array and launches a script. I created a VBA macro in excel that calls the dll function.
the function are:
long __stdcall Init(); long __stdcall AddInput(double* data, long nRows, long nCols, const char* label); long __stdcall ExecFile(const char* file); void __stdcall Clear();
everything works fine as long as I don't import matplotlib.
Infact if I try to import matplotlib.pyplot in python script and plot an array an exception is thrown.
How can I use matplotlib.pyplot in script called from a dll embedding python?
the script i'm trying to exec is
import numpy as np
import matplotlib.pyplot as plt
import sys
def main():
try:
sys.stdout = open("outPy.log","w")
plt.plot([1,2,4],[1,2,3])
plt.show()
except:
print("Unexpected error:", sys.exc_info()[0])
print("Unexpected error:", sys.exc_info()[1])
print("Unexpected error:", sys.exc_info()[2])
finally:
sys.stdout.close()
if __name__ == '__main__':
main()
the exception is:
Unexpected error: <class 'IndexError'>
Unexpected error: list index out of range
Unexpected error: <traceback object at 0x2061C030>
What I have tried:
Is this because I'am calling the dll from VBA?
Is it a question of thread?