Re: Python not Running

2021-01-20 Thread Sibylle Koczian

Am 19.01.2021 um 17:48 schrieb Dennis Lee Bieber:

On Tue, 19 Jan 2021 03:26:50 + (UTC), Mladen Gogala via Python-list
 declaimed the following:


Since you're most probably using Winduhs, use regedit and modify your PATH


You don't need to use regedit to modify environment variables.

Right click "This PC" (Win10), Properties, Advance System Settings
(respond to UAC prompt), [Environment Variables]

This presents a window with "user" (the admin account being used after
the UAC authorization) and "system" which are the environment variables
that apply to all users.

To change regular user environment variables, open old-style control
panel, drill down in "User Accounts" until your get to your account, and
there will be an option on the left for editing environment variables.


It's not necessary to have Python in the path - it may perhaps be a 
little more comfortable, but not much. The file extensions .py and .pyw 
can be associated with python and pythonw, there is the Python Launcher, 
and for things like pip you can always change into your Python 
directory. But pip works just as well with the Launcher.



--
https://mail.python.org/mailman/listinfo/python-list


Re: Issues with running python in Command prompt

2021-01-20 Thread Michael Torrie
On 1/19/21 10:40 PM, Mladen Gogala via Python-list wrote:
> I generally advise
> using Cygwin and installing the Cygwin version of Python. Your OS will 
> look like a POSIX compatible system, and you will be able to use Unix/
> Linux tools like bash, less. vi, awk, grep and alike. You will also be 
> able to use "/" as a directory separator which is really helpful when it 
> comes to regular expressions.

I've used cygwin for many years.  I would not use cygin if I were the
OP.  This is probably for more advanced users with particular needs.  I
recommend sticking to the official windows version of Python, and
following the detailed instructions on the web page Mats Wichmann
referred to.

You can use escape characters in regular expression on any platform
Python runs on.  Python has a whole host of features to deal with the
directory separator differences on Windows vs everybody else.
-- 
https://mail.python.org/mailman/listinfo/python-list


sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.

2021-01-20 Thread panfei
System environment:

Cent OS 7
Sqlite3 3.34.0 (Compile from source)
Python 3.9.1 (Compile from source)
Django 3.1.5 (Pip install)


1. Compile sqlite3:
./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
make && make install

2. Add sqlite3 lib to lib search path:

export LD_LIBRARY_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/lib
export LD_RUN_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/lib

3. Compile Python 3.9.1
C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
make && make install

4. Test sqlite3
Python 3.9.1 (default, Jan 20 2021, 14:32:50)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
Traceback (most recent call last):
  File "", line 1, in 
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>> 

It reports "deterministic=True requires SQLite 3.8.3 or higher", but when 
execute sqlite3.sqlite_version it returns 3.34.0 which higher than 3.8.3.

Is there any advice on this issue? thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.

2021-01-20 Thread Ben Bacarisse
panfei  writes:

> 4. Test sqlite3
> Python 3.9.1 (default, Jan 20 2021, 14:32:50)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
 import sqlite3
 conn = sqlite3.connect(':memory:')
 conn.create_function('f', 2, lambda *args: None, deterministic=True)
> Traceback (most recent call last):
>   File "", line 1, in 
> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher
 sqlite3.sqlite_version
> '3.34.0'
 sqlite3.version
> '2.6.0'
 
>
> It reports "deterministic=True requires SQLite 3.8.3 or higher", but
> when execute sqlite3.sqlite_version it returns 3.34.0 which higher
> than 3.8.3.
>
> Is there any advice on this issue? thanks.

Sorry, no, but I can add a data point.  It works for me on my Ubuntu
system with these versions:

$ python3
Python 3.8.5 (default, Jul 28 2020, 12:59:40) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.31.1'
>>> sqlite3.version
'2.6.0'
>>> conn = sqlite3.connect(':memory:')
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
>>> 

-- 
Ben.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.

2021-01-20 Thread Random832
On Wed, Jan 20, 2021, at 14:54, panfei wrote:
> 3. Compile Python 3.9.1
> C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
> --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
> make && make install

How *exactly* did you compile python? i.e. what specific commands, to make it 
pick up those include paths? Because from the symptoms you are reporting, it 
sounds like it was not compiled against the correct version of sqlite.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.

2021-01-20 Thread Barry Scott



> On 20 Jan 2021, at 19:54, panfei  wrote:
> 
> System environment:
> 
> Cent OS 7
> Sqlite3 3.34.0 (Compile from source)
> Python 3.9.1 (Compile from source)
> Django 3.1.5 (Pip install)
> 
> 
> 1. Compile sqlite3:
> ./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
> make && make install
> 
> 2. Add sqlite3 lib to lib search path:
> 
> export LD_LIBRARY_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/lib
> export LD_RUN_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/lib
> 
> 3. Compile Python 3.9.1
> C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
> --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
> make && make install
> 
> 4. Test sqlite3
> Python 3.9.1 (default, Jan 20 2021, 14:32:50)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
 import sqlite3
 conn = sqlite3.connect(':memory:')
 conn.create_function('f', 2, lambda *args: None, deterministic=True)
> Traceback (most recent call last):
>  File "", line 1, in 
> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher
 sqlite3.sqlite_version
> '3.34.0'
 sqlite3.version
> '2.6.0'
 
> 
> It reports "deterministic=True requires SQLite 3.8.3 or higher", but when 
> execute sqlite3.sqlite_version it returns 3.34.0 which higher than 3.8.3.
> 
> Is there any advice on this issue? thanks.

My guess is that at runtime the systems old sqlite3 is used and not your new 
one.
is LD_LIBRARY_PATH setup correctly when you run python3.9?

You can check this by doing the following:

$ gdb python3.9
(gdb) run
>>> import sqlite3
Ctrl-C
(gdb) info shared

Below is that I get on a Fedora 33 system by way of example output:

$ gdb python3.9
GNU gdb (GDB) Fedora 10.1-2.fc33
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python3.9...
Reading symbols from .gnu_debugdata for /usr/bin/python3.9...
(No debugging symbols found in .gnu_debugdata for /usr/bin/python3.9)
Missing separate debuginfos, use: dnf debuginfo-install 
python3-3.9.1-1.fc33.x86_64
(gdb) run
Starting program: /usr/bin/python3.9 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Python 3.9.1 (default, Dec  8 2020, 00:00:00) 
[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> 
Program received signal SIGINT, Interrupt.
0x77b7ff4a in select () from /lib64/libc.so.6
(gdb) i sh
>FromTo  Syms Read   Shared Object Library
0x77fd2090  0x77ff2f96  Yes (*) /lib64/ld-linux-x86-64.so.2
0x77caed30  0x77e58c7d  Yes (*) /lib64/libpython3.9.so.1.0
0x77aad690  0x77bfa69d  Yes (*) /lib64/libc.so.6
0x77a6ca90  0x77a7b125  Yes (*) /lib64/libpthread.so.0
0x77a60270  0x77a611c9  Yes (*) /lib64/libdl.so.2
0x77a5a3f0  0x77a5adb0  Yes (*) /lib64/libutil.so.1
0x779223d0  0x779bd718  Yes (*) /lib64/libm.so.6
0x77fbca50  0x77fbe310  Yes (*) 
/usr/lib64/python3.9/lib-dynload/readline.cpython-39-x86_64-linux-gnu.so
0x7fffea1dc270  0x7fffea204587  Yes (*) /lib64/libreadline.so.8
0x7fffea1a3470  0x7fffea1afb8c  Yes (*) /lib64/libtinfo.so.6
0x7fffea22ba70  0x7fffea2316ef  Yes (*) 
/usr/lib64/python3.9/lib-dynload/math.cpython-39-x86_64-linux-gnu.so
0x7fffea13ead0  0x7fffea149d8c  Yes (*) 
/usr/lib64/python3.9/lib-dynload/_datetime.cpython-39-x86_64-linux-gnu.so
0x77fb2170  0x77fb318b  Yes (*) 
/usr/lib64/python3.9/lib-dynload/_heapq.cpython-39-x86_64-linux-gnu.so
0x7fffea128510  0x7fffea1308ee  Yes (*) 
/usr/lib64/python3.9/lib-dynload/_sqlite3.cpython-39-x86_64-linux-gnu.so
0x7fffe9fd79b0  0x7fffea0c7024  Yes (*) /lib64/libsqlite3.so.0
0x7fffe9fb05f0  0x7fffe9fbdb2b  Yes (*) /lib64/libz.so.1
(*): Shared library is missing debugging information.
(gdb) 

You can see that the python module is:
 /usr/lib64/python3.9/lib-dynload/_sqlite3.cpython-39-x86_64-linux-g

Re: sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.

2021-01-20 Thread Random832
On Wed, Jan 20, 2021, at 16:45, Random832 wrote:
> On Wed, Jan 20, 2021, at 14:54, panfei wrote:
> > 3. Compile Python 3.9.1
> > C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
> > CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
> > LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
> > --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
> > make && make install
> 
> How *exactly* did you compile python? i.e. what specific commands, to 
> make it pick up those include paths? Because from the symptoms you are 
> reporting, it sounds like it was not compiled against the correct 
> version of sqlite.

Oh, sorry, I missed "./configure" on that line.

So, it looks like you had the environment variables set when you ran configure, 
but not make. I don't think this is a common way to set include paths, by the 
way. The usual way is with pkg-config, but I'm not sure how to add your .local 
sqlite directory to it. Does your sqlite installation include a file called 
"sqlite3.pc"? If so, try adding the directory containing it to PKG_CONFIG_PATH 
when running configure.

If not... well, export the environment variables or add them when running make 
and hope for the best
-- 
https://mail.python.org/mailman/listinfo/python-list


[ANN] PyYAML-5.4.1 Released

2021-01-20 Thread Matt Davis
===
Announcing PyYAML-5.4.1
===

A new release of PyYAML is now available:
https://github.com/yaml/pyyaml/releases/tag/5.4.1

This release contains a fix for AttributeError during module import in some
mixed version installations.

PyYAML 5.4.1 will be the last release to support Python 2.7 (except for
possible
critical bug fix releases).


Changes
===

* https://github.com/yaml/pyyaml/pull/480 -- Fix stub compat with older
pyyaml versions that may unwittingly load it


Resources
=

PyYAML IRC Channel: #pyyaml on irc.freenode.net
PyYAML homepage: https://github.com/yaml/pyyaml
PyYAML documentation: http://pyyaml.org/wiki/PyYAMLDocumentation
Source and binary installers: https://pypi.org/project/PyYAML/
GitHub repository: https://github.com/yaml/pyyaml/
Bug tracking: https://github.com/yaml/pyyaml/issues

YAML homepage: http://yaml.org/
YAML-core mailing list:
http://lists.sourceforge.net/lists/listinfo/yaml-core


About PyYAML


YAML is a data serialization format designed for human readability and
interaction with scripting languages. PyYAML is a YAML parser and emitter
for
Python.

PyYAML features a complete YAML 1.1 parser, Unicode support, pickle support,
capable extension API, and sensible error messages. PyYAML supports standard
YAML tags and provides Python-specific tags that allow to represent an
arbitrary Python object.

PyYAML is applicable for a broad range of tasks from complex configuration
files to object serialization and persistence.


Example
===

```
>>> import yaml

>>> yaml.full_load("""
... name: PyYAML
... description: YAML parser and emitter for Python
... homepage: https://github.com/yaml/pyyaml
... keywords: [YAML, serialization, configuration, persistence, pickle]
... """)
{'keywords': ['YAML', 'serialization', 'configuration', 'persistence',
'pickle'], 'homepage': 'https://github.com/yaml/pyyaml', 'description':
'YAML parser and emitter for Python', 'name': 'PyYAML'}

>>> print(yaml.dump(_))
name: PyYAML
homepage: https://github.com/yaml/pyyaml
description: YAML parser and emitter for Python
keywords: [YAML, serialization, configuration, persistence, pickle]
```

Maintainers
===

The following people are currently responsible for maintaining PyYAML:

* Ingy döt Net
* Matt Davis

and many thanks to all who have contributed!
See: https://github.com/yaml/pyyaml/pulls


Copyright
=

Copyright (c) 2017-2021 Ingy döt Net 
Copyright (c) 2006-2016 Kirill Simonov 

The PyYAML module was written by Kirill Simonov .
It is currently maintained by the YAML and Python communities.

PyYAML is released under the MIT license.
See the file LICENSE for more details.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Issues with running python in Command prompt

2021-01-20 Thread Mladen Gogala via Python-list
On Wed, 20 Jan 2021 08:33:40 -0700, Michael Torrie wrote:

> You can use escape characters in regular expression on any platform
> Python runs on.  Python has a whole host of features to deal with the
> directory separator differences on Windows vs everybody else.

I am probably slightly biased. I am an old Unix hack who has learned Perl4 
in the early 90's and was using it until 2019 when I was told that Perl 
is not an approved language in the company and that I have to learn 
Python. So I did. I was a VAX/VMS system admin and instructor from 1987 - 
1996. After 1993 I was working for a SGI distributor, using Irix. I have 
worked with HP-UX, AIX, AT&T Unix, Wyse Unix, SCO Unix and, eventually, 
Linux, among other things. I might be slightly biased against Windows.

-- 
Mladen Gogala
Database Consultant
https://dbwhisperer.wordpress.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.

2021-01-20 Thread panfei
HI Barry, Thanks for the suggestions, this is my output:

[felix@localhost Downloads]$ gdb 
/home/felix/.local/python/python-3.9.1/bin/python3
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-120.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from 
/home/felix/.local/python/python-3.9.1/bin/python3.9...done.
(gdb) run
Starting program: /home/felix/.local/python/python-3.9.1/bin/python3 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Python 3.9.1 (default, Jan 21 2021, 02:04:50) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> 
Program received signal SIGINT, Interrupt.
0x76a15983 in __select_nocancel () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.17-317.el7.x86_64 
ncurses-libs-5.9-14.20130511.el7_4.x86_64 
nss-softokn-freebl-3.53.1-6.el7_9.x86_64 readline-6.2-11.el7.x86_64 
zlib-1.2.7-18.el7.x86_64
(gdb) info shared
FromTo  Syms Read   Shared Object Library
0x77ddbaf0  0x77df7060  Yes (*) /lib64/ld-linux-x86-64.so.2
0x778af410  0x77a7fd82  Yes 
/home/felix/.local/python/python-3.9.1/lib/libpython3.9.so.1.0
0x77613e30  0x77618cec  Yes (*) /lib64/libcrypt.so.1
0x773fc8f0  0x77407db1  Yes (*) /lib64/libpthread.so.0
0x771f3e50  0x771f494e  Yes (*) /lib64/libdl.so.2
0x76ff0e90  0x76ff17a4  Yes (*) /lib64/libutil.so.1
0x76cf3350  0x76d5e316  Yes (*) /lib64/libm.so.6
0x7693f9f0  0x76a8f9cf  Yes (*) /lib64/libc.so.6
0x7671db80  0x7671e1fb  Yes (*) /lib64/libfreebl3.so
0x7fffeffd50b0  0x7fffeffd6952  Yes 
/home/felix/.local/python/python-3.9.1/lib/python3.9/lib-dynload/readline.cpython-39-x86_64-linux-gnu.so
0x7fffefda0de0  0x7fffefdbf775  Yes (*) /lib64/libreadline.so.6
0x7fffefb6ee40  0x7fffefb7abb8  Yes (*) /lib64/libtinfo.so.5
0x7fffef9557c0  0x7fffef95c9b2  Yes 
/home/felix/.local/python/python-3.9.1/lib/python3.9/lib-dynload/math.cpython-39-x86_64-linux-gnu.so
0x7fffef6f4cd0  0x7fffef7080b8  Yes 
/home/felix/.local/python/python-3.9.1/lib/python3.9/lib-dynload/_datetime.cpython-39-x86_64-linux-gnu.so
0x7fffef4e8c40  0x7fffef4ebd13  Yes 
/home/felix/.local/python/python-3.9.1/lib/python3.9/lib-dynload/_heapq.cpython-39-x86_64-linux-gnu.so
0x7fffef2d7180  0x7fffef2e08ba  Yes 
/home/felix/.local/python/python-3.9.1/lib/python3.9/lib-dynload/_sqlite3.cpython-39-x86_64-linux-gnu.so
0x7fffeefadf00  0x7fffef096c00  Yes 
/home/felix/.local/sqlite/default/lib/libsqlite3.so.0
0x7fffeed8b110  0x7fffeed97698  Yes (*) /lib64/libz.so.1
(*): Shared library is missing debugging information.
(gdb) 

I created a symbol link to specific version of sqlite3 and set LD_LIBRARY_PATH:

[felix@localhost sqlite]$ ll
total 0
lrwxrwxrwx 1 felix felix  6 Feb 18  2020 default -> latest
lrwxrwxrwx 1 felix felix 13 Jan 20 12:51 latest -> sqlite-3.34.0
drwxrwxr-x 6 felix felix 52 Feb 18  2020 sqlite-3.31.1
drwxrwxr-x 6 felix felix 52 Jan 20 12:51 sqlite-3.34.0
[felix@localhost sqlite]$ pwd
/home/felix/.local/sqlite
[felix@localhost sqlite]$ env | grep LD_
LD_LIBRARY_PATH=/home/felix/.local/mpfr/default/lib/:/home/felix/.local/gmp/default/lib/:/home/felix/.local/mpc/default/lib/:/home/felix/.local/sqlite/default/lib:/home/felix/.local/mysql/default/lib
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib




在 2021年1月21日星期四 UTC+8 上午5:53:38, 写道:
> > On 20 Jan 2021, at 19:54, panfei  wrote: 
> > 
> > System environment: 
> > 
> > Cent OS 7 
> > Sqlite3 3.34.0 (Compile from source) 
> > Python 3.9.1 (Compile from source) 
> > Django 3.1.5 (Pip install) 
> > 
> > 
> > 1. Compile sqlite3: 
> > ./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0 
> > make && make install 
> > 
> > 2. Add sqlite3 lib to lib search path: 
> > 
> > export LD_LIBRARY_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/lib 
> > export LD_RUN_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/lib 
> > 
> > 3. Compile Python 3.9.1 
> > C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
> > CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
> > LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
> > --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations 
> > make && make install 
> > 
> > 4. Test sqlite3 

Re: sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.

2021-01-20 Thread panfei
Hi Random:
Thanks for the suggestion, I will test it right now. there is a file called 
sqlite3.pc in my installation.

[felix@localhost pkgconfig]$ ll
total 4
-rw-r--r-- 1 felix felix 315 Jan 20 12:51 sqlite3.pc
[felix@localhost pkgconfig]$ pwd
/home/felix/.local/sqlite/default/lib/pkgconfig

在 2021年1月21日星期四 UTC+8 上午5:57:43, 写道:
> On Wed, Jan 20, 2021, at 16:45, Random832 wrote: 
> > On Wed, Jan 20, 2021, at 14:54, panfei wrote:
> > > 3. Compile Python 3.9.1 
> > > C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
> > > CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
> > > LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
> > > --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations 
> > > make && make install 
> >
> > How *exactly* did you compile python? i.e. what specific commands, to 
> > make it pick up those include paths? Because from the symptoms you are 
> > reporting, it sounds like it was not compiled against the correct 
> > version of sqlite.
> Oh, sorry, I missed "./configure" on that line. 
> 
> So, it looks like you had the environment variables set when you ran 
> configure, but not make. I don't think this is a common way to set include 
> paths, by the way. The usual way is with pkg-config, but I'm not sure how to 
> add your .local sqlite directory to it. Does your sqlite installation include 
> a file called "sqlite3.pc"? If so, try adding the directory containing it to 
> PKG_CONFIG_PATH when running configure. 
> 
> If not... well, export the environment variables or add them when running 
> make and hope for the best
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.

2021-01-20 Thread panfei
1033  C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations 
 1034  C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make
 1035  make clean
 1036  C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations 
 1037  C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make
 1038  C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make install
 1039  /home/felix/.local/python/python-3.9.1/bin/python3
 1040  history 
[felix@localhost Python-3.9.1]$ 
/home/felix/.local/python/python-3.9.1/bin/python3
Python 3.9.1 (default, Jan 21 2021, 10:58:50) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:') 
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
>>> 


Thanks very !  Every step in compilation should be with the same environment 
variable. Thanks again!


在 2021年1月21日星期四 UTC+8 上午5:57:43, 写道:
> On Wed, Jan 20, 2021, at 16:45, Random832 wrote: 
> > On Wed, Jan 20, 2021, at 14:54, panfei wrote:
> > > 3. Compile Python 3.9.1 
> > > C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
> > > CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
> > > LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
> > > --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations 
> > > make && make install 
> >
> > How *exactly* did you compile python? i.e. what specific commands, to 
> > make it pick up those include paths? Because from the symptoms you are 
> > reporting, it sounds like it was not compiled against the correct 
> > version of sqlite.
> Oh, sorry, I missed "./configure" on that line. 
> 
> So, it looks like you had the environment variables set when you ran 
> configure, but not make. I don't think this is a common way to set include 
> paths, by the way. The usual way is with pkg-config, but I'm not sure how to 
> add your .local sqlite directory to it. Does your sqlite installation include 
> a file called "sqlite3.pc"? If so, try adding the directory containing it to 
> PKG_CONFIG_PATH when running configure. 
> 
> If not... well, export the environment variables or add them when running 
> make and hope for the best
-- 
https://mail.python.org/mailman/listinfo/python-list


etree, gzip, and BytesIO

2021-01-20 Thread Frank Millman

Hi all

This question is mostly to satisfy my curiosity.

In my app I use xml to represent certain objects, such as form 
definitions and process definitions.


They are stored in a database. I use etree.tostring() when storing them 
and etree.fromstring() when reading them back. They can be quite large, 
so I use gzip to compress them before storing them as a blob.


The sequence of events when reading them back is -
   - select gzip'd data from database
   - run gzip.decompress() to convert to a string
   - run etree.fromstring() to convert to an etree object

I was wondering if I could avoid having the unzipped string in memory, 
and create the etree object directly from the gzip'd data. I came up 
with this -


   - select gzip'd data from database
   - create a BytesIO object - fd = io.BytesIO(data)
   - use gzip to open the object - gf = gzip.open(fd)
   - run etree.parse(gf) to convert to an etree object

It works.

But I don't know what goes on under the hood, so I don't know if this 
achieves anything. If any of the steps involves decompressing the data 
and storing the entire string in memory, I may as well stick to my 
present approach.


Any thoughts?

Frank Millman

--
https://mail.python.org/mailman/listinfo/python-list