Using Python module in MT4

 

I'm using 7bit's python extension. It's very nice thanks.

But now I have a problem.

I want to use module of python named "lxml".

But it was not worked.

If I import the module,

PyExecute("from lxml import etree");

this Error is occured.

File "C:\Python26x86\lib\site-packages\lxml\html\__init__.py", line 12, in <module>

from lxml import etree

ImportError: DLL load failed: The specified module could not be found.


lxml module is work well in python interpreter.

Could anyone help ?

Sorry for my poor English. I'm Japanse.

 

This is a PATH problem. It cannot find one of the needed dlls.

I have seen the same sort of error myself when using the e1071 svm through R through RPy through Python through py26.mqh (a lot of layers ;-)

i solved it by adding the directory where the needed DLL is to the PATH variable. In my case it was a dll inside the R folder and i added it to the path only temporarily through os.environ before the import statement: (but you can also make this permanent in the windows environment settings)

Example:

PyExecute("os.environ['PATH'] += ';C:/Progra~1/R/R-2.9.1/bin'");


Of course the above path is R specific and your path would be somewhere else where the lxml or etree has its dlls located. You need to find which dll it is trying to load and modify the above example so that it points to the directory where this dll is located.

 
7bit:

This is a PATH problem. It cannot find one of the needed dlls.

I have seen the same sort of error myself when using the e1071 svm through R through RPy through Python through py26.mqh (a lot of layers ;-)

i solved it by adding the directory where the needed DLL is to the PATH variable. In my case it was a dll inside the R folder and i added it to the path only temporarily through os.environ before the import statement: (but you can also make this permanent in the windows environment settings)

Example:

PyExecute("os.environ['PATH'] += ';C:/Progra~1/R/R-2.9.1/bin'");


Of course the above path is R specific and your path would be somewhere else where the lxml or etree has its dlls located. You need to find which dll it is trying to load and modify the above example so that it points to the directory where this dll is located.


Hello 7 bit,from forexfactory I found you are sharing your findings of using R to integrate with MT4 to do statistical arbitrage trading (pair trading), it is very interesting works indeed. SVM is quite a popular topic as it claims it can overcome the drawbacks from Neural Net.... Would you mind also sharing your findings/exerience of using the SVM library too. Thx
Reason: