Jump to content

SwiftExpat

Members
  • Content Count

    222
  • Joined

  • Last visited

  • Days Won

    9

Posts posted by SwiftExpat


  1. For anyone who struggles with py embeddable in the future, here are some working executables for you to troubleshoot with.

    Validate your python embeddable setup, confirm package installation and test your imports.

     

    FMX and VCL X64 compiled executables in the releases :

     

    Source code  & sample "_pth" file is available in the GitHub Repo :

    https://github.com/SwiftExpat/ValidatePythonEmbeddable

     

    Usage:

    1. Click on browse DLL , this will set the dllname and path correctly and then allow you to adjust other component properties.
    2. Then load DLL

    image.thumb.png.70fa3292ee7e1c8c3846c7c8621594c5.png

     

    PIP List

    Pip results can be confusing, so I have automated the PIP list command to ensure it runs from the embeddedable dist.

    image.thumb.png.7205275865248b47ee8fe21fc0c8f6f1.png

     

    More should be done for this, but this is a start and feel free to fork the repository or make suggestions.

    • Like 1
    • Thanks 1

  2. In Delphi 11.3 I am curious if anyone else has seen this behavior. I can not reproduce this yet, but it has happened several times and I am curious if anyone else has seen this.

     

    I will likely rebuild this project group to see if it resolves.

     

    Symptoms / Cause of error

    • I have open a project group with ~20 projects in the list.
    • I am debugging projectA
    • I am looking at the source and the IDE prompts for recompile
    • recompile happens but random projectB executes ( I had not debugged or compiled this program in days )
    • no projects are active in the project group

     

    Activate projectA and everything works fine again.

     


  3. 12 hours ago, Robert Gilland said:

    The process is already running and working.

    But speed is a critical factor and there is a need to increase performance. 

    Profiling that code is necessary to figure out which component is taking the time, as Brian Evans said above.

     

    I use one component which takes 23 ms to execute the create. That is a long time considering there are 5 instances on the form.

     

    My fix was to delay creation of the 4 instances not visible.


  4. Glad to see you sticking with it and it sounds like you are close. I spent a long time on this but having it stable pays off in the end.

     

    Something simple like this is what I use, so just change python to 3.11

    2 hours ago, JGMS said:

    I can probably manage that, but after installation on the target machine the DLLPath should first be redirected to subfolder "3.11" in the path of the executable. On this one I am stuck.

    TPath.Combine(TPath.GetDirectoryName(paramstr(0)), 'python');

     

    Pip should resolve packages in your embedded dist, this is why you use the package with the -m option. If it does not the dist is not importing site correctly and you are going to chase errors.

    Here is my working, by changing to the directory it will use the python binary from that folder first, so double check with the double -V.  After that the concern is the location of the package, it should show in your embedded.

    C:\Users\Coder\AppData\Local\Programs\RunTime_ToolKit\python>python -V -V
    Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)]
    
    C:\Users\Coder\AppData\Local\Programs\RunTime_ToolKit\python>python -m pip list -v
    Package               Version     Location                                                                       Installer
    --------------------- ----------- ------------------------------------------------------------------------------ ---------
    astroid               2.5         c:\users\coder\appdata\roaming\python\python39\site-packages                   pip
    bcrypt                3.2.0       c:\users\coder\appdata\local\programs\runtime_toolkit\python\lib\site-packages pip

    Now for the pth file, it should look like this:

    python39.zip
    .
    
    .\Scripts
    .\Lib
    .\Lib\site-packages
    # Uncomment to run site.main() automatically
    import site

    The last piece you will need is msvc runtime, python does not require it but likely a module you use will

    python -m pip install msvc_runtime

    Now you are not done yet, because Delphi wants to load that DLL from the same directory as your exe. So as part of your install just copy the dlls from python over to your exe dir.

    I did this for the same question a while back, so here it is as reference:

    image.thumb.png.447337b457a0e39f3126a522619acce1.png


  5. 29 minutes ago, JGMS said:

    Is copying the folders Numpy and OpenCV sufficient? Or better: when compiling goes without complaining, could anything still be missing?

    I used pip to install them into my embedded dist, that will check for any dependencies.

    python -m pip install numpy
    python -m pip install opencv-contrib-python

     

    You should be able to diff using

    --List modules in embedded
    python -m pip list -v
    --list modules from other distribution
    pip list -v

     


  6. Application lifecycle and updates should drive the decision, not disk space.

     

    Write out a timeline of 3-4 update cycles for your applications and determine if you want them to both depend on the same python embedded.  Can you manage that inter-dependency through the update cycle?

     

    How it looks on the target machine is a question for your customer. As long as you are not modifying the machine path the answer is likely that they will not care.

     

    If the products mature, you can always consolidate them later.


  7. April 4 @ 3pm UCT I will be demonstrating how Marshal can be used to debug components at runtime.  This release includes support for TMS WebCore.

     

    Signup here : https://www.tmssoftware.com/site/tmswebacademy.asp?id=150

     

    Get hands on experience using the Web Core demo here: https://swiftexpat.github.io/RunTime-ToolKit/MarshalDemo_Web/MarshalDemo.html

     

    Product page & purchase info: https://swiftexpat.com/


  8. Honestly, the folks over at gateway are very up front about the job, they want a developer who can travel onsite to do installs.  And they are up front!

     

    Now for the more experienced developer, you might consider this 🙂  from linkedin. These folks are looking for grey beard on a minimal salary.

     

    ..........................

     

    Role: Delphi Developer
    Location : Frederick, MD (Remote)
    Duration: Long Term

    Remote – OK but Associate must be in EST zone
    Job Description:
    Looking For 6+yrs Delphi Developer with Below Skills.

    Qualifications:

    • Should have 10-12 years of strong experience in Software Development in Delphi.
    • Should be an expert in Delphi development and Technical Analysis Documentation.
    • Ability to effectively resolve performance/memory leak/scalability issues.
    • Develops, enhances and maintains Pension and Retirement applications using Delphi, Cobol, MS SQL and Btrieve files.
    • Excellent understanding of any RDBMS like Oracle or SQL Server.
    • Strong results orientation, excellent verbal and written communication skills.
    • Should be capable of handling product versions, documentation and development standards.
    • Participates in the analysis and design of the client's system applications.
    • Ability to understand code in Delphi 7 and convert to 64-Bit Delphi XE8.
    • Good technical, analytical and communication skills.
    • Strong expertise in application development using Delphi, Interbase and SQL Server.
    • Strong knowledge of COM, ODBC, OOPS concepts and XML.
    • Sound experience on developing Client Server applications and libraries.
    • Expertise on PLSQL, RDBMS concepts and development using relational databases.
       

    Roles and Responsibilities :

    • Responsible for developing software solutions which are technically and architecturally sound in principle.
    • Adherence to commitments delivery timelines and development guidelines.
    • Run and monitor software performance tests on new and existing programs for the purposes of correcting errors, determining areas of improvement and general debugging.

    --

    Thanks & Regards
    Anand Raj | Lead - Talent Acquisition (US Division)
    Teamware Solutions Inc |2838 E. Long Lake Road,Suite# 210, TROY, MI 48085 😧 |

    • provided by Dice

  9. Think of it as embedded = portable ( no need to install, just make the binaries available ).

    Remember as well you are loading python into Delphi which does not have c runtime. C runtime might be required by some python modules.

    python -m pip install msvc_runtime

    This is the layout I use and it works correctly. My python install procedure copies c runtime to the EXE folder so that it loads it on the path.

     

    image.png.2ecb3e97e90afc628e3bac17345b3135.png

    • Like 1

  10. Similar topic last week, short so its worth a review

    Declare your own procedures to handle the event, here there is one for NewTicket and OldTicket:  See the notes in the Datamodule create procedure for if you want to handle it via compiler defines or switch based on some app value using an if statement. 

    interface
    
    uses
      System.SysUtils, System.Classes, Data.DB, Datasnap.DBClient, FireDAC.Stan.Intf, FireDAC.Stan.Option,
      FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, FireDAC.Comp.DataSet,
      FireDAC.Comp.Client;
    
    type
      TdmMarshalDemo = class(TDataModule)
        cdsFeatures: TClientDataSet;
        cdsFeaturesFeatureName: TStringField;
        fdMemTblVideos: TFDMemTable;
        fdMemTblVideosVideoID: TStringField;
        fdMemTblVideosTitle: TStringField;
        fdMemTblVideosDescription: TStringField;
        dsVideos: TDataSource;
        procedure DataModuleCreate(Sender: TObject);
      private
        procedure dsNewTicketDataChange(Sender: TObject; Field: TField); 
        procedure dsOldTicketDataChange(Sender: TObject; Field: TField); 
      public
        function CurrentVideo: TDemoVideo;
      end;
    
    var
      dmMarshalDemo: TdmMarshalDemo;
    
    implementation
    
    {%CLASSGROUP 'FMX.Controls.TControl'}
    {$R *.dfm}
    { TdmMarshalDemo }
    
    procedure TdmMarshalDemo.DataModuleCreate(Sender: TObject);
    begin
    
      //compiler defines
    {$IFDEF RELEASE}
      dsVideos.OnDataChange := dsNewTicketDataChange;
    {$ELSE}
      dsVideos.OnDataChange := dsOldTicketDataChange;
    {$ENDIF}
    
    //app logic
      if 1 = 1 then
        dsVideos.OnDataChange := dsNewTicketDataChange
      else
        dsVideos.OnDataChange := dsOldTicketDataChange;
    end;
    
    procedure TdmMarshalDemo.dsNewTicketDataChange(Sender: TObject; Field: TField);
    begin
    
    end;
    
    procedure TdmMarshalDemo.dsOldTicketDataChange(Sender: TObject; Field: TField);
    begin
    
    end;
    
    end.

     

×