Jump to content
Sign in to follow this  
matrix1233

installing/Executing Python4Delphi App on MacOs (Lazarus) (could not map symbol "Py_DebugFlag")

Recommended Posts

Hi,

Am trying to execute a simple application (Demo1) with Python4Delphi on MacOs Catalina so i tried two Method:

Method 1: - Compiling Demo1 on Windows to    - Target OS Darwin  

                                                                                 - Target CPU i86_64

                     => Demo1 app is generated correctly and when i move it to Mac and i execute it i have a Error  ( Error: could not map symbol "Py_DebugFlag" )

                                                      Capture d’écran 2020-12-25 à 11.42.52 AM.png

 

 

Method 2: - Installing Lazarus on MacOs with Python4Delphi and executing the Demo1 (of corse i added the correct path to the lib ) :

                     => Demo1 when start it generate the same  Error (See the screenshot below)

 

                                          Capture d’écran 2020-12-25 à 11.40.43 AM.png

 

How can i correct this ? 

Thanks

 

 

 

 

 

Edited by matrix1233

Share this post


Link to post

Yes it's the latest version installed on Lazarus Windows and Lazarus MacOs (just for info When i change the target (to compile on windows) of lazarus installed on Windows it's work ) 

Edited by matrix1233

Share this post


Link to post

Strange.  Py_DebugFlag should be exported on all platforms.  Please uncomment the line with the Import  - Import(Py_DebugFlag).  Does it work then?

Share this post


Link to post

In that case what happens of you comment out the importing of all flags?

Edited by pyscripter

Share this post


Link to post

Hi if i comment from Import('Py_DebugFlag') to Import('Py_IgnoreEnvironmentFlag') i have :

 334154845_Capturedecran2020-12-28a6_09_41AM.thumb.png.6242ba2c7563bb81064f729e35e4821e.png

 

and if you means that i have to comment from Import('Py_DebugFlag') to Import('PyGILState_Release') i have this error :

Capture d’écran 2020-12-28 à 6.03.15 AM.png

Capture d’écran 2020-12-28 à 6.03.30 AM.png

Edited by matrix1233

Share this post


Link to post

Ok.  There must be something wrong with the dynamic library you are using.   P4D has been used without such issues in MacOS.

Could you please try to install a different version of python say 3.7 or 3.9 and test with that?

 

Can any other MacOS user shed some light here?

Edited by pyscripter

Share this post


Link to post
11 minutes ago, matrix1233 said:

The strange think is if i install python4lazarus( https://github.com/Alexey-T/Python-for-Lazarus/) it's work

But the two are almost identical nowadays and they both import Py_DebugFlag etc.   Could you please pinpoint what makes the differences (e.g. by stepping through the code)?  That would be very useful.  

 

If you do have access to Delphi for the MacOS can you please also try with that?

Edited by pyscripter

Share this post


Link to post

Hi,

I installed the last version of python on my Mac

 1805631942_Capturedecran2020-12-28a7_20_25AM.thumb.png.d41a8af40eadf54c9133f58df90a9250.png

 

With python 3.9.i have the same error =>

 

1097686180_Capturedecran2020-12-28a7_32_36AM.thumb.png.b9eed00468d6f213c28374291ffb981f.png

 

I installed a second time python4lazarus to test with python3.9 and it's work ==>

 

580875324_Capturedecran2020-12-28a7_53_41AM.thumb.png.8d2e0d0d8cc152459f8d237d7ce76812.png

 

Now i added another test :

 1 - Installed Python4lazarus (with working demo1)

 2 - using Demo1 with library of lazarus and changing the file PythonEngine.pas (lazarus) with the PythonEngine.pas (python4Delphi)  and i have the same error Error: could not map symbol "Py_DebugFlag" ) so the problem is on this file .

 

At this time i do not  have access to access to Delphi for MacOS. i will test when i will have access as soon possible.

 

 

Edited by matrix1233

Share this post


Link to post
3 hours ago, matrix1233 said:

1 - Installed Python4lazarus (with working demo1)

 2 - using Demo1 with library of lazarus and changing the file PythonEngine.pas (lazarus) with the PythonEngine.pas (python4Delphi)  and i have the same error Error: could not map symbol "Py_DebugFlag" ) so the problem is on this file .

Could you debug MapDLL in both and try to see whether they differ?  I have looked at the code and could not see any significant difference.

 

Edited by pyscripter

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×