Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python3.7 not able to identified. #113

Closed
mamin27 opened this issue Feb 18, 2020 · 16 comments
Closed

Python3.7 not able to identified. #113

mamin27 opened this issue Feb 18, 2020 · 16 comments

Comments

@mamin27
Copy link

mamin27 commented Feb 18, 2020

I tested code at Ubuntu 19.04 with Python 3.7 and library

/usr/lib/x86_64-linux-gnu/libpython3.7m.so

I changed PythonEngine.pas file to


{$IFDEF _so_files}
  PYTHON_KNOWN_VERSIONS: array[1..8] of TPythonVersionProp =
    (
    (DllName: 'libpython2.7.so'; RegVersion: '2.7'; APIVersion: 1013),
    (DllName: 'libpython3.2.so'; RegVersion: '3.2'; APIVersion: 1013),
    (DllName: 'libpython3.3.so'; RegVersion: '3.3'; APIVersion: 1013),
    (DllName: 'libpython3.4.so'; RegVersion: '3.4'; APIVersion: 1013),
    (DllName: 'libpython3.5.so'; RegVersion: '3.5'; APIVersion: 1013),
    (DllName: 'libpython3.6.so'; RegVersion: '3.6'; APIVersion: 1013),
    (DllName: 'libpython3.7m.so'; RegVersion: '3.7'; APIVersion: 1013),
    (DllName: 'libpython3.8.so'; RegVersion: '3.8'; APIVersion: 1013)
    ); 

Then the python3.7 was recognized but at least not correctly initialized.
at line 3057


      // set the argv list of the sys module with the application arguments
      PySys_SetArgv3000( argc + 1, wargv );

With error message:

Project Project1 raised exception class 'External: SIGABRT'.
In file '../sysdeps/unix/sysv/linux/raise.c' at line 50

Currently is recognized only Python 2.7.
Maybe you will know how to fix it.

@pyscripter
Copy link
Owner

@Alexey-T
Any idea what is going on?

@Alexey-T
Copy link

Alexey-T commented Feb 18, 2020

I use Linux with Py 36 and 37, all ok.
I don't use autodetection by lib name.
Seems asker uses some cmd line params in his demo and Py reads it.

@pyscripter
Copy link
Owner

@Alexey-T
What is the difference between libpython3.7m.so and libpython3.7.so?

@Alexey-T
Copy link

none, these are just some names - different linuxes use different names.

@Alexey-T
Copy link

In CudaText I have

{
  "font_name__linux" : "DejaVu Sans Mono",
  "font_size__linux" : 9,
  "ui_tab_angle" : 3,
  "ui_listbox_fuzzy" : false,
  "pylib__linux" : "libpython3.7m.so.1.0",

@mamin27
Copy link
Author

mamin27 commented Feb 18, 2020

Hi Alex and Pyscripter,
I prepared Demo02 - Demo06 (https://github.com/mamin27/Python-for-Lazarus/tree/master/demo_delphi/FPC) at https://github.com/mamin27/Python-for-Lazarus (Alex clone). Most of them were correctly tested. I would like to merge Alex an Pyscripter code but is is so different.
It will be better to merge your skills into one project. Delphi and FPC (Lazarus).

@Alexey-T
Copy link

@mamin27 I will merge your demo2..demo6 into my repo. Just delete programs "project1" (file size 20M)

@pyscripter
Copy link
Owner

Ok I got it. https://www.python.org/dev/peps/pep-3149/.

@mamin27
Copy link
Author

mamin27 commented Feb 18, 2020

Hi pyscripter, I did not understood your link.
library looks like this:


omet@comet-ThinkPad-L540:~/project/lazarus/Python-for-Lazarus$ ls -l /usr/lib/x86_64-linux-gnu/libpython3.7*
lrwxrwxrwx 1 root root      57 Oct  7 14:56 /usr/lib/x86_64-linux-gnu/libpython3.7m.a -> ../python3.7/config-3.7m-x86_64-linux-gnu/libpython3.7m.a
lrwxrwxrwx 1 root root      18 Oct  7 14:56 /usr/lib/x86_64-linux-gnu/libpython3.7m.so -> libpython3.7m.so.1
lrwxrwxrwx 1 root root      20 Nov 30 15:28 /usr/lib/x86_64-linux-gnu/libpython3.7m.so.1 -> libpython3.7m.so.1.0
-rw-r--r-- 1 root root 5080176 Oct  7 14:56 /usr/lib/x86_64-linux-gnu/libpython3.7m.so.1.0

@pyscripter
Copy link
Owner

@mamin27 This PEP says that library files are marked with m if they are compiled with PyMemAloc which is the default. Apparently this only applies to non-Window distributions.

@pyscripter
Copy link
Owner

@mamin27
Could you please check the latest version. There was an issue with SetProgramArgs and Linux UCS4 strings.

@pyscripter
Copy link
Owner

pyscripter commented Feb 19, 2020

@Alexey-T
Could you please try on Linux with your version of P4Lazarus

import sys
print(sys.argv)

I think is should show garbage. Then can you please check my fix?

@Alexey-T
Copy link

Alexey-T commented Feb 19, 2020

On Linux CudaText console panel shows that sys.argv is [] (even when app has command line pars)

@pyscripter
Copy link
Owner

Ah! Because of:

 Exit; //AT: code hangs on Linux x64
        //////////////////////////////

Could you please test my fix?

@Alexey-T
Copy link

It works good
Screenshot from 2020-02-19 19-50-04

@pyscripter
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants