Jump to content

Nefari0

Members
  • Content Count

    5
  • Joined

  • Last visited

Everything posted by Nefari0

  1. Hi! Have a some issue - lxml in TPythonThread with Delphi don´t works but it works in OwnThreadstate with the same script Code: from lxml import html it calls the error - this module can only be loaded into one interpreter per process And when I try to run Code: BeautifulSoup(html_source,"lxml") it calls the error - FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library? but in OwnThreadstate with the same script works good. Same way the Code: BeautifulSoup(html_source,"html.parser") in TPythonThread is works, but I need lxml glad to any suggestions
  2. Hello! when I try to run "import pandas" or "import openpyxl" in TPythonThread I got stopped thread without any errors but in OwnThreadState Tpythonengine it works example of code PyCodeList.Add('import pandas'); InitThread(emNewInterpreter, PyCodeList); - thread was stopped after few seconds without any errors if I don't import pandas or openpyxl then other commands and modules are working good in this thread example of working code PyCodeList.Add('import pandas'); GetPythonEngine.ExecStrings(PyCodeList); - all ok sorry for my english
  3. I decided to stop using pandas in Python inerpreter and return list to delphi for processing it in delphi instead of python´s panda And this is what I got: data in python data=[['123',456],['321',654]] sendrawrada(data) and I got it in delphi with function function TMainForm.send_raw_data( pself, args : PPyObject ) : PPyObject; cdecl; var R: byte; data: PPyObject; row: array of variant; col: array of variant; i,j:word; rowSize:byte; colSize:byte; resstr:string; begin with GetPythonEngine do begin R:=PyArg_ParseTuple(Args, 'O:sendrawdata', @data); if R<>0 then begin application.ProcessMessages; row:=pyobjectasvariant(data); rowSize:=Length(row); for i:= 0 to rowSize-1 do begin col:=row; colSize:=Length(col); resstr:=''; for j:=0 to colSize-1 do begin resstr:=resstr+vartostr(col[j]); end; resmemo.Lines.Add(resstr); end; SendMessage(resmemo.Handle, WM_VSCROLL, SB_BOTTOM, 0); Result := ReturnNone; end else Result := nil; end; end; here is the test code
  4. Thanks I got it It´s the procedure that create threads and executes python scripts. I got it from demo33 p4d I try to use python threads to avoid blocking the UI.
  5. Nefari0

    lxml in TPythonThread with Delphi don´t works

    I'll try to understand it. Thanks
×