Jump to content

pyscripter

Members
  • Content Count

    1020
  • Joined

  • Last visited

  • Days Won

    66

Posts posted by pyscripter


  1. On 1/14/2023 at 8:12 PM, uefi said:

    Hello, I can not get the result of the script execution instead of the result I get: 

    value=none

    What did you expect to get?

    Demo03 shows you how to use TPythonDelphiVar.


  2. Call you delphi module say "delphimodule"  and in your script:

     

    import delphimodule

    print(delphimodule.QUANTITY);

     

    or 

    from delphimodule import QUANTITY

    print(QUANTITY)

     

    Please look at the demos, before asking questions here and do yourself a favour.  Do watch the two video tutorials. It is only two hours viewing and will save you masses of time if you plan to do any serious work with P4D.


  3. 10 minutes ago, Juan C.Cilleruelo said:

     PyEngine.LoadDll;

          p := PyEngine.PyLong_FromLong(1);
          PyModule.SetVar('QUANTITY', p);
          PyEngine.Py_DecRef(p);

          PyEngine.IO := FPythonIO;

    Set PyEngine.IO before you call LoadDLL

     

    Redirection is setup by TPythonEngine.Initialize, which is called by LoadDLL.


  4. P4D works fine with miniconda distributions.  Read FindingPython · pyscripter/python4delphi Wiki (github.com) for details.

    1 hour ago, superc said:

    I Download embeddable version of Python 3.10.8 and copy *.dll and python310.zip

    There is no need to do that.  If on the other hand you want to deploy python with your application, have a look at this project Embarcadero/PythonEnviroments: Components to simplify the deployment for Python environments for Delphi applications using Python4Delphi. (github.com)

     


  5. 10 minutes ago, programmerdelphi2k said:

    just unchecking "Inherit" (on Event) does not works?

    If you uncheck the event inherit in derived configurations, then you would need to define it again.

    The question is why Delphi replicates an event defined for All Configurations for each configuration and how you can prevent that. 


  6. 20 minutes ago, Uwe Raabe said:

    Which platforms are in that project?

    Win32 and Win64.

     

    The problem was that the following was in the project file:

        <PropertyGroup Condition="'$(Cfg_2)'!=''">
            <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
            <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
        </PropertyGroup>

    which was overriding the platform settings.  I don't know how this got into the project file.  Project Magician was not cleaning it and this was overriding the platform settings.  After deleting the Manifest line in the above, things seem to work as expected.

     

    One more question.  I have a build event defined for all configurations.  Delphi keeps one replicating that for every configuration:

        <PropertyGroup Condition="'$(Config)'=='Debug' And '$(Platform)'=='Win32'">
            <PreBuildEvent/>
            <PreBuildEventIgnoreExitCode>False</PreBuildEventIgnoreExitCode>
            <PreLinkEvent/>
            <PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode>
            <PostBuildEvent>copy "$(BDS)\Redist\$(Platform)\WebView2Loader.dll" $(OUTPUTDIR) </PostBuildEvent>
            <PostBuildEventIgnoreExitCode>False</PostBuildEventIgnoreExitCode>
        </PropertyGroup>

    The above is replicated for all configurations.   Even when I manually delete the above from the project file manually, Delphi recreates it.  Any idea why?  Could that be cleaned up?


     

     


  7. 57 minutes ago, Uwe Raabe said:

    Correct! That is the setting that allows to set the custom manifest for all configurations.

    In Project Magician options "Clear Application Settings" is set on by default.

    But I still cannot set Manifest options for all configurations.   How do I do that?

     

    Update:  RTDS  

    "All application settings in child configurations are removed and the base settings put in charge again. This effects the Icons, Manifest File, Output Settings and Appearance. Application settings are always platform based and thus the settings in the platform base configuration are the ones to be kept."

     

    I need to set them for each platform.

     


  8. Project Magician by @Uwe Raabe is such a great idea, but somehow every time I decide to use it, I end up regretting it.

    This time the issue relates to custom manifest files.  My project had one, but after activating Project Magician, saving and building my project this custom manifest file was not included.  My application was released with a wrong manifest file.:classic_angry:

    I went to Project Options, set it again, save my project, close, open again, the setting disappeared.

    What am I doing wrong?  Delphi does not allow me to set the custom manifest for all configurations.  It has to be set for each configuration individually.

     


  9. Is this a failure to load the python DLL or an error when executing python scripts?

    Are you using the latest sources from the Github repo?

     

    Also check out the following:

    FindingPython · pyscripter/python4delphi Wiki (github.com)

    MaskFPUExceptions · pyscripter/python4delphi Wiki (github.com)

     

    If you are using python version 3.11.1 then please try with  version 3.11.0 or earlier.   There is a change related to the loading of dynamic libraries (dll) in 3.11.1, that I am looking into.  See regression with latest Python 3.11.1 and _socket not found · Issue #100171 · python/cpython (github.com)

×