Jump to content

pyscripter

Members
  • Content Count

    983
  • Joined

  • Last visited

  • Days Won

    62

Everything posted by pyscripter

  1. pyscripter

    ssh tunnel with ssh-pascal

    Probably not. When you add commits to the same branch, the commits are added to the PR. If you want to have separate PRs you need different branches for each change. Anyway your changes have been merged and you are listed as a contributor.
  2. pyscripter

    ssh tunnel with ssh-pascal

    @dummzeuch I think handling connections sequentially should be quite easy, without resorting to multiple threads. Once one is closed you wait for the next one. Please bear in mind, that there are limitations when using libssh2 from multiple threads: Points 1 and 3 are the same, since the crypto functions are initialized by libssh2_init. Ssh_pascal handles this in a thread safe manner. The second point, I think means that you either have a session per thread or you protect with a lock, access to the same session and its channels,
  3. pyscripter

    ssh tunnel with ssh-pascal

    A Pull Request implementing an alternative design that resolves this issue would be much appreciated.
  4. pyscripter

    ssh tunnel with ssh-pascal

    The code in SshTunnel.pas is based on this libssh2 example. Maybe I missed something, in converting it to Delphi. It would be nice to fix it.
  5. pyscripter

    ssh tunnel with ssh-pascal

    @dummzeuch I have pushed a couple of fixes to SshTunnel.pas (issues found by Copilot!). Could you please check whether they make a difference? One of them might: SocketOption := 1; // Initialize SocketOption
  6. LIBSUFFIX AUTO has been a much requested feature for ages. The Delphi 10.4.1 announcement said: Sounded interesting so I decided to try that. I first searched the documentation and found the following: So I added {$LIBSUFFIX AUTO} to a package of mine say xyz.dpk and the bpl file generated was indeed xyz270.bpl. However I got an error message saying: This much for "full support" for this feature. Am I missing something??
  7. pyscripter

    Is there a way to run .pyc files?

    See How can I import a .pyc compiled python file and use it - Stack Overflow
  8. pyscripter

    SynEdit now has annotated Scrollbars.

    There are about 75 highlighters and It is not too difficult to add new ones. You can start with a highlighter for a language that is quite similar and adapt it, e.g. change the keywords. There is also SynGen that helps you create a highlighter from scratch. You can request a highlighter and someone may have or contribute a new one. Regarding Powershell have a look at this discussion. It contains an extended General highlighter that can be adapted to practically any language. PSPad uses that unit to support syntax highlighting for 180 programming languages.
  9. pyscripter

    No python engine was created error

    I have no idea what you are trying to accomplish, but for instance you can put the PythonModule in a data module. Instead of using AddDelphiMethod directly. you could add an Event to the PythonModules Event's collection. Events are converted to python functions, which delegate the execution to a Delphi event handler. Then, every time the form is created, it could assign a handler to the event's OnExecute property.
  10. pyscripter

    No python engine was created error

    You should not free modules that have been initialized and loaded into python while the python engine is active. python has references to procedures of the module and this may lead to crashing python. You can destroy modules after python has finailized.
  11. pyscripter

    SynEdit now has annotated Scrollbars.

    Works here with the same version. Are you using the latest sources now from the master branch.
  12. pyscripter

    SynEdit now has annotated Scrollbars.

    Flow control symbols have also been added: Technical details.
  13. pyscripter

    SynEdit now has annotated Scrollbars.

    Structural highlighting has also been added. Technical details.
  14. pyscripter

    Using Python4Delphi library in a Windows service

    In the demo project modify the CreateEngine function as follows: procedure TService1.CreatePyEngine; begin PythonEngine := TPythonEngine.Create(nil); PythonEngine.Name := 'PythonEngine'; PythonEngine.DLLName := 'python313.dll'; PythonEngine.DllPath := 'c:\python\python313\'; PythonEngine.PythonHome := PythonEngine.DLLPath; PythonEngine.VenvPythonExe := PythonEngine.DLLPath + 'python.exe'; // may be needed PythonEngine.RegVersion := '3.13'; PythonEngine.UseLastKnownVersion := False; PythonEngine.FatalAbort := False; PythonEngine.FatalMsgDlg := False; PythonEngine.LoadDll; TPythonThread.Py_Begin_Allow_Threads; end; I think this should set the python path correctly and avoid import errors.
  15. pyscripter

    Using Python4Delphi library in a Windows service

    What I think is best: - Create the pythonEngine (or load the python dll) on Start - Destroy the pythonEngine (or unload the python dll) on Stop - Follow these guideliines to execute python code in threads. Please see the attached project for an example that does that. Sample log output after starting and stopping the engine: Logs From Background Thread: 24/10/2024 14:49:18 Python eval = 4 Logs From Background Thread: 24/10/2024 14:49:19 Python eval = 4 Logs From Background Thread: 24/10/2024 14:49:20 Python eval = 4 Logs From Background Thread: 24/10/2024 14:49:21 Python eval = 4 Service.zip
  16. I very much like the "Filter Explicit properties" expert. However, in recent versions of Delphi (not sure when it started), the IDE inserts annoying DesignSize properties that "pollute" the Dfm and the revision history. It would be really nice if the expert was renamed "Filter DFM properties" and included the option of removing these DesignSize properties.
  17. pyscripter

    Feature enhancement request - Filter DFM properties

    The understatement of the year.
  18. Delphi 12.2 is now available for download from https://my.embarcadero.com/.
  19. pyscripter

    Using Python4Delphi library in a Windows service

    When you run as a service the registry information is not available. You need to do something like: procedure TService1.CreatePyEngine; begin PythonEngine := TPythonEngine.Create(nil); PythonEngine.Name := 'PythonEngine'; PythonEngine.DLLName := 'python313.dll'; PythonEngine.DllPath := 'c:\pathtoyourpythonhome\'; PythonEngine.RegVersion := '3.13'; PythonEngine.UseLastKnownVersion := False; PythonEngine.FatalAbort := False; PythonEngine.FatalMsgDlg := False; PythonEngine.LoadDll; end; I have tested and it works.
  20. pyscripter

    win11 24h2 msheap fastest

    Do you have any code you can share?
  21. pyscripter

    win11 24h2 msheap fastest

    I am also sceptical. However, I see that in one of the most starred Github Delphi repos, danieleteti/delphimvcframework: DMVCFramework (for short) is a popular and powerful framework for WEB API in Delphi. Supports RESTful and JSON-RPC WEB APIs development., the IDE expert project generator, includes MSHeap by default. @Daniele TetiCould you please enlighten us as to what led you to this choice? By the way the RTL can be configured to use MSHeap, if compiled with the SIMPLEHEAP conditional define. The downside is that ReportMemoryLeaksOnShutdown is not available with MSHeap.
  22. pyscripter

    String memory usage

    This is the unit @Stefan Glienke was referring to. 100 lines and it uses no other unit!
  23. pyscripter

    How to run a multi-process script

    Set UseWindowConsole to True and in the FormCreate add: ShowWindow(GetConsoleWindow, SW_HIDE);
  24. pyscripter

    How to run a multi-process script

    It is a bit tricky to run multiprocessing from P4D. For instance with Demo01: - Set VenvPythonExe to the appropriate python.exe path e.g. 'c:\python\python313\python.exe' - If you are printing from the processes and you want to see the output set UseWindowsConsole to True. In your script there is no printing from the processes. - Add to the above script as first statement: __file__ = file_path - Save your script to that filepath - Run the demo and exec your script.
  25. This is just to say that pyscripter/Ssh-Pascal: Delphi ssh library wrapping libssh2 (github.com) includes binaries that do not require OpenSSL, but use Windows CNG instead. It also includes scripts that make it very easy to update the binaries.
×