limelect 48 Posted June 26 After very long and many tries I need your help This is my script works on other Python script pyinstaller.exe --windowed D4P_export_demo.py --onefile --paths="C:\Users\LimElect\anaconda3\Lib\site-packages\delphifmx\" --name D4P_export_demo the path is not needed as I get the same Python error pyinstaller.exe --windowed D4P_export_demo.py --onefile --name D4P_export_demo It seems to find the packet but cannot use it The package is used without any problems in PyScripter warn-D4P_export_demo.txt does not show that the package is missing Any Idea? P.S. Final message 5303 INFO: Building EXE from EXE-00.toc completed successfully. Share this post Link to post
pyscripter 694 Posted June 26 Have you followed the instructions at DelphiVCL4Python/samples/Installer at main · Embarcadero/DelphiVCL4Python (github.com) for delphivcl DelphiFMX4Python/samples/Installer at main · Embarcadero/DelphiFMX4Python (github.com) for delphifmx Share this post Link to post
limelect 48 Posted June 27 I did but still, in some places, there is a misunderstanding of mine It compiles OK but exe does not do the job where am I wrong? pythone.zip Share this post Link to post
limelect 48 Posted June 27 P.S i also changed a = Analysis( ['Project2.py'], Share this post Link to post
limelect 48 Posted June 27 I have used this site to simplify https://stackoverflow.com/questions/23594048/how-can-i-specifiy-the-spec-file-in-pyinstaller And I get the same result from the execute Something very wrong P.S I changed the datas= as needed Share this post Link to post
limelect 48 Posted June 28 (edited) @pyscripter Can you plz put here an FMX or VCL Pas/PY hello World zip project that you make to an EXE. I will change the library path compile and see what happens. Thanks P.S It will be the best demo possible Edited June 28 by limelect Share this post Link to post
limelect 48 Posted July 3 Guys to begin thanks for your attention 1. Either no one except me plays with Delphi for Python 2. Maybe I found that the Python package cannot make an execute. 3. This that there is no response says something 4 So I moved to QT designer with PyQt5 where the Python package does work and give me an execute. 5. I prefer Delphi but for the time being until proven otherwise it is out for me P.S I could not install PyQt6 but that is another matter Share this post Link to post
DelphiUdIT 181 Posted July 3 (edited) Let's explain ... I'm not an expert about Python, but i work on some P4D projects and I see some issues (they are not really issues, but you cannot do some things if those happens). Look for script TEST.PY and Delphi lib pyTRYSF.pyd in the attached example. First of all: instead to do "onefile", do the standard distribution that pyinstaller do ... try only (from the pyinstaller environment): pyinstaller test.py This will create the folders that containing the executable and all the necessary files (including your .pyd library compiled with Delphi): dist\test\_internal Inside "dist\test" ther will be an executable (test.exe) and in the subfolder "_internal" should be all necessary for running the exe, INCLUDED pyTRYSF.pyd) !!!! For running any delphi library with Python is necessary to link the Pythonxxx.dll main engine at runtime. This mean that this engine should be found. When you run a python script that import a Delphi dll normally (eg. after you installed Python in Windows) your module can link the standard pythonxxx.dll library installed and is the same that the python "shell" call. If you are running the test.exe program created by pyinstaller, the pythonxxx.dll library is not the standard library, but is the DLL that is inside the "_internal" subfolder, where the pyd module is too. This "_internal\pythonxxx.dll" should be link at runtime by Delphi dll (pyTRYSF.pyd in the example). If you don't link this at runtime, you will never be able to execute your "pyd". In the example attached there is an example how I modified the link engine procedure to search the correct lib ... it works without changes with installed python engine or with pyinstaller (but no with --onefile parameters). Why the --onefiles parameters doesn't works ? 2 are the issues: 1) The pyd is not included by pyinstaller in the executable (with --onefile). 2) The executable unzip the same files like "_internal" in a temporary directory. This lead the impossibility to link the pythonxxx.dll because when the test.exe is executed the execution path is the ".\" of the test.exe an not the temporary directory. There are no chance for Delphi pyd module to link the correct pythonxxx.dll. May be the P4D guru can help in this. Bye N.B.: the example works only with Python 3.12 by now. DelphiDLLforPython.zip Edited July 3 by DelphiUdIT Share this post Link to post
devd 0 Posted July 3 (edited) Unit1.pas : .. #- self.Label2.caption="" self.Label2.Caption="" #+ should: Caption and change all.. Here I have changed everything. .. delphivclexecutable.spec: .. #+I'm using: Windows 11, Python 3.10, and pyinstaller==6.8.0 a = Analysis( #- ['delphivclexecutable.py'], ['Project2.py'], #+ pathex=[], binaries=[], #- datas=[(r"C:\Users\LimElect\anaconda3\Lib\site-packages\delphivcl", "delphivcl")] , datas=[(r"C:\Users\LimElect\anaconda3\Lib\site-packages\delphivcl", "delphivcl"), ("Unit1.py", "."), ("Unit1.pydfm", ".")] , #+ .. the above correction work for me. demo: attach 7z have 2 splits, i can't upload split2. forum limit file only 4m+ sorry : pythone_Fixed.7z.001 Edited July 3 by devd Share this post Link to post
devd 0 Posted July 3 ok. I can now upload split file 2. pythone_Fixed.7z.002 Share this post Link to post
limelect 48 Posted July 4 16 hours ago, DelphiUdIT said: Look for script TEST.PY and Delphi lib pyTRYSF.pyd in the attached example. Where is it? 2. cannot open pythone_Fixed.7z.002 is it zip or 7z? non open Share this post Link to post
DelphiUdIT 181 Posted July 4 58 minutes ago, limelect said: Where is it? I attached a zip file in the previous post : https://en.delphipraxis.net/applications/core/interface/file/attachment.php?id=11265 Inside there is all, two Delphi projects and a Python script. Share this post Link to post
limelect 48 Posted July 4 (edited) @DelphiUdIT Sorry Your zip gives an error My zip program is the latest Also, it is not a zip as I look inside it does not have the zip initials It should have PK PLZ make sure it is ZIP Edited July 4 by limelect Share this post Link to post
Lajos Juhász 294 Posted July 4 It is strange I can open it. Combine the two split files into a .7z and you open it using Windows Explorer. Share this post Link to post
limelect 48 Posted July 4 (edited) Look inside the file https://en.delphipraxis.net/applications/core/interface/file/attachment.php?id=11265 It does not contain PK first letters which designate zip Unless you open it differently I open it with BANDZIP. My Window 7 does not recognize the file P.S I also have 7 zip on my windows Edited July 4 by limelect Share this post Link to post
limelect 48 Posted July 4 (edited) Is it for LINOXS as we are working on Windows there is no 7ZipFM for Windows unless you know the link. It suppose to be part of 7zip but cannot find it Edited July 4 by limelect Share this post Link to post
Lajos Juhász 294 Posted July 4 7zFM from the screenshot is part of the 7zip. Share this post Link to post
limelect 48 Posted July 4 OK I found on the portable project 7ZipFM but is cannot open eiyher Share this post Link to post
Lajos Juhász 294 Posted July 4 It is not a rocket science to combine two files: copy /b pythone_Fixed.7z.001+pythone_Fixed.7z.002 pythone_Fixed.7z Devd gave the reason why it is not a single zip "attach 7z have 2 splits, i can't upload split2. forum limit file only 4m+ sorry" Share this post Link to post
limelect 48 Posted July 4 Well I do not understand as I have 3 zip/7zip non open including 7zipfm I am stack If it helps (without an exe) my mail limelect@gmail,com or www,limelect.com where you find lots of free staff Share this post Link to post
limelect 48 Posted July 4 (edited) @davd Finally it open can you also send pas sources to see if my D10,2,3 make what needed I will compile yours and see WWWWAAAA great you put also my librery Edited July 4 by limelect Share this post Link to post
limelect 48 Posted July 4 (edited) It works !!!!! Lovely next to see where I made mistakes OK it is my PAS file THANKS a lot, much appreciate Edited July 4 by limelect Share this post Link to post