Jump to content

pyscripter

Members
  • Content Count

    777
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by pyscripter

  1. pyscripter

    Html Help: Ctrl+F not working

    Thanks for responding. No, it is not that. I have tested with a new minimal app, just a form and a button to open the help file, and the issue still exists. I think it used to work with earlier versions of Windows/Delphi.
  2. pyscripter

    Looking for a localization tool

    In PyScripter we use dxgettext along with https://www.transifex.com/ for translations teams collaboration and github integration. dxgettext offers a great deal of control as to what should get translated and there is an advantage in using industry standard translation formats for which a variety of editing and management tools exist.
  3. Indeed. As I said it is not foolproof. If you use a specific set of python modules, you can see in Delphi's debug mode which DLLs are loaded when your python scripts execute. You can then write code to unload them after unloading python. Failing to unload a DLL does not necessarily mean that there will be an issue next time you load python.
  4. Running python in threads does not increase python code speed due to the GIL. Only one thread executes at any point in time. Torch can do its own mutli-threading so again there is no need to use threads. The main reason for using python threads is to avoid blocking the UI.
  5. Unloading and reloading has always been possible with P4D, but quite tricky and not foolproof. You need to manually unload the dll's loaded by imported modules and if you fail to do that it will fail. PyScripter does that and allows you to change python version without exiting.
  6. Why are you making things complicated? Follow the KISS rule. Using threads in this way requires deep knowledge of the Python API and the complexities of GIL. If do have to use threads, please study Demo 11 and the related posts in this forum Showing results for 'Py_Begin_Allow_Threads'. - Delphi-PRAXiS [en] (delphipraxis.net)
  7. It does, but it is not a good idea and should be avoided. See demo34 for how it can work. This demonstrates also AutoLoad = False
  8. Set AutoLoad to False and call LoadDLL at Runtime (e.g. in your FormCreate).
  9. PythonHome needs to be set even for registered conda distributions See TPythonVersion.AssignTo(PythonEngine: TPersistent); in PythonVersions.pas about this is done. Note also that for conda distributions to work properly, you need to add Format('%s;%0:s\Library\bin;', [Version.InstallPath] to your Windows path if it is not there already.
  10. Is there another sqlite dll in your path?
  11. pyscripter

    First Python + DelphiVCL Program

    It is cross-platform. It supports all targets Delphi supports.
  12. pyscripter

    The Delphi 11.2 release thread

    Same here. 11.1 was better I think with respect to LSP.
  13. pyscripter

    Extremely slow

    In general, Python scripts run just as fast (or better just as slow) using P4D in Delphi, as they do using python.exe. You need to show what you are doing in that respect.
  14. pyscripter

    an error message in new version of PyEngine

    MaskFPUExceptions · pyscripter/python4delphi Wiki (github.com)
  15. pyscripter

    Lazarus/FPC support

    Python4Lazarus is a fork focusing on fpc support. It does not include the based on WrapDelphi, delphifmx, delphivcl stuff.
  16. pyscripter

    Lazarus/FPC support

    This is now fixed. @acalandCould you please report whether fpc MacOS works ok?
  17. pyscripter

    Returning lists from Python to Delphi

    Variants are converted to strings when shown in the debugger. It does not mean that they contain strings.
  18. pyscripter

    Returning lists from Python to Delphi

    No it does not. You get a tuple containing arrays of floating type values. Are you using VarPyth? Is layerOutputs a Variant? If yes then you can use: var arr:Variant := layerOutputs.GetItem(0); // the first item of the tupple (array). var value:Variant := arr.GetItem(0); //the first floating value of the array
  19. pyscripter

    The Delphi 11.2 release thread

    By the way and on record helpers, in my little program above, if you move the declaration var Rec: MyRec; to Unit 1, interestingly, the output is "Hi".
  20. pyscripter

    The Delphi 11.2 release thread

    The issue was in the following: procedure TRegExHelper.AddRawOptions(PCREOptions: Integer); begin with Self do FRegEx.SetAdditionalPCREOptions (PCREOptions); end; FRegEx is defined in System.RegularExpressions and the nearest helper was in that unit. By the way the issue is now fixed. Thanks for reporting it.
  21. pyscripter

    The Delphi 11.2 release thread

    Actually it is the other way round. From the docs: but "nearest scope" means closer to where the variable is declared. Just to prove: Project File: program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, Unit1 in 'Unit1.pas'; type MyRecHelper2 = record helper for MyRec procedure SayHi; end; { MyClassHelper1 } procedure MyRecHelper2.SayHi; begin WriteLn('Hello!'); end; var Rec: MyRec; begin Rec.SayHi; ReadLn; end. Unit 1 unit Unit1; interface type MyRec = record end; MyRecHelper1 = record helper for MyRec procedure SayHi; end; implementation { MyClassHelper1 } procedure MyRecHelper1.SayHi; begin WriteLn('Hi!'); end; end. Output: Hello!
  22. pyscripter

    The Delphi 11.2 release thread

    What happens then in Delphi 11.2? Which record helper will be active? I thought you are not allowed to have two helpers for the same class in the same scope?
  23. pyscripter

    The Delphi 11.2 release thread

    Yes indeed. Do you know how to IFDEF 11.2 vs 11.1?
  24. pyscripter

    The Delphi 11.2 release thread

    Regular Expressions have been revamped. The following feature requests have been implemented: https://quality.embarcadero.com/browse/RSP-21733 https://quality.embarcadero.com/browse/RSP-22372 https://quality.embarcadero.com/browse/RSP-22381
×