[issue10740] sqlite3 module breaks transactions and potentially corrupts data
Gerhard Häring added the comment: Isn't this issue at least partly about the statement parsing code in the sqlite module? I've fixed this upstream a while ago in https://github.com/ghaering/pysqlite/commit/94eae5002967a51782f36ce9b7b81bba5b4379db Could somebody perhaps bring this to the Python repository. Here's a documentation update that's also required then: https://github.com/ghaering/pysqlite/commit/cae87ee68613697a5f4947b4a0941f59a28da1b6 -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10740> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19065] sqlite3 timestamp adapter chokes on timezones
Gerhard Häring added the comment: I'm -1 because I believe that ultimately, adapters and converters were a mistake to add to pysqlite. That's why I deprecated them in pysqlite 2.8.0. Do you know what would be the correct step to propose a deprecation in the sqlite3 module of Python proper? Is a PEP necessary? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19065 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16379] SQLite error code not exposed to python
Gerhard Häring added the comment: I propose to also set the SQLite extended error code if this is implemented. What's the reasoning behind offering a error code to name mapping? This seem problematic to me. In case a newer SQLite version introduces a new error code, this error code cannot be found in the mapping. I propose to leave this out in order to not have this problem. Otherwise we will have people depending on any error code being able to be found in this mapping. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16379 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: [python-sqlite] Re: pysqlite 2.8.0 released
Yes, I forgot to setup.py sdist upload. It's fixed now. Sorry for the trouble. I'm of course looking forward to hear if SQLAlchemy still works ok with this release. On Wed, Aug 19, 2015 at 10:10 PM, zzz...@gmail.com wrote: Hi Gerhard - is the download missing? On Pypi I see 2.8.0 is registered but no download file: https://pypi.python.org/pypi/pysqlite/2.8.0 pip fails: $ ./bin/pip install pysqlite==2.8.0 --upgrade --force Collecting pysqlite==2.8.0 Could not find a version that satisfies the requirement pysqlite==2.8.0 (from versions: 2.5.6, 2.6.0, 2.6.3, 2.7.0) Some externally hosted files were ignored as access to them may be unreliable (use --allow-external to allow). No distributions matching the version for pysqlite==2.8.0 On Tuesday, August 18, 2015 at 8:17:46 PM UTC-4, Gerhard Häring wrote: NEW FEATURES - No new features, but tons of bugfixes. These mean that things now work that didn't before: - Transactional DDL now works - You can use SAVEPOINTs now BUILD PROCESS - Python 2.7.x is now required. If trying to use it with Python 3, print a useful error message. Integrated all fixes from the sqlite3 module in Python 2.7.10. MAJOR IMPROVEMENTS - Completety got rid of statement parsing. We now use SQLite functions to determine if a statement modifies the database or not. If a statement modifies the database, then we implicitly start a transaction. For backwards compatibility reasons, we do NOT implicitly start a transaction if we encounter a DDL statement. You can, however, now have transactional DDL if you want to: cur = con.cursor() cur.execute(begin) cur.execute(create table foo(bar)) con.rollback() This also means that people can now finally use SAVEPOINTS. - Use sqlite3_get_autocommit() to determine if we are within a transaction instead of trying to be smart. - Switch to v2 statement API. This simplified the code and will increase stability. MINOR IMPROVEMENTS - You can use unicode strings as index for Row objects. BUGFIXES - Fixed a regression: statements should not be reset after a commit. GENERAL CLEANUP AND DEPRECATIONS - Since december 2005, row_factory is a feature of the Connection class instead of the Cursor class. It was kept in the Cursor class for backwards compatibility. Now it was time to finally remove it from the Cursor class. - DEPRECATE converters and adapters. - DEPRECATE text_factory. - Remove compatibility workarounds for old Python versions. - Remove workarounds for old SQLite versions. - Remove apsw related code. -- --- You received this message because you are subscribed to the Google Groups python-sqlite group. To unsubscribe from this group and stop receiving emails from it, send an email to python-sqlite+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- https://mail.python.org/mailman/listinfo/python-list
[issue16885] SQLite3 iterdump ordering
Gerhard Häring added the comment: http://bugs.python.org/issue20463 is related. -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16885 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3783] dbm.sqlite proof of concept
Gerhard Häring added the comment: This wiki page is out of date. It appears that SQlite is now threadsafe by default: http://www.sqlite.org/threadsafe.html -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3783 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10740] sqlite3 module breaks transactions and potentially corrupts data
Gerhard Häring added the comment: Please note that after the mentioned commit, I restored backwards compatibility with commit https://github.com/ghaering/pysqlite/commit/796b3afe38cfdac5d7d5ec260826b0a596554631 Now the only difference is that the implicit commits *before* DDL statements are gone. I consider these a bug anyway. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10740 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
pysqlite 2.8.0 released
NEW FEATURES - No new features, but tons of bugfixes. These mean that things now work that didn't before: - Transactional DDL now works - You can use SAVEPOINTs now BUILD PROCESS - Python 2.7.x is now required. If trying to use it with Python 3, print a useful error message. Integrated all fixes from the sqlite3 module in Python 2.7.10. MAJOR IMPROVEMENTS - Completety got rid of statement parsing. We now use SQLite functions to determine if a statement modifies the database or not. If a statement modifies the database, then we implicitly start a transaction. For backwards compatibility reasons, we do NOT implicitly start a transaction if we encounter a DDL statement. You can, however, now have transactional DDL if you want to: cur = con.cursor() cur.execute(begin) cur.execute(create table foo(bar)) con.rollback() This also means that people can now finally use SAVEPOINTS. - Use sqlite3_get_autocommit() to determine if we are within a transaction instead of trying to be smart. - Switch to v2 statement API. This simplified the code and will increase stability. MINOR IMPROVEMENTS - You can use unicode strings as index for Row objects. BUGFIXES - Fixed a regression: statements should not be reset after a commit. GENERAL CLEANUP AND DEPRECATIONS - Since december 2005, row_factory is a feature of the Connection class instead of the Cursor class. It was kept in the Cursor class for backwards compatibility. Now it was time to finally remove it from the Cursor class. - DEPRECATE converters and adapters. - DEPRECATE text_factory. - Remove compatibility workarounds for old Python versions. - Remove workarounds for old SQLite versions. - Remove apsw related code. -- https://mail.python.org/mailman/listinfo/python-list
[issue16958] The sqlite3 context manager does not work with isolation_level=None
Gerhard Häring added the comment: I'm +1 on deprecating the connection manager -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16958 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20463] sqlite dumpiter dumps invalid script when virtual tables are used
Gerhard Häring added the comment: apsw contains code that handles the issues with dumping SQLite databases very well. I plan to integrate this code into pysqlite. We can then later port the fix to the sqlite3 module. See https://github.com/ghaering/pysqlite/issues/10 for the tasks and https://github.com/rogerbinns/apsw/blob/master/tools/shell.py#L1012 for the apsw code. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20463 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11691] sqlite3 Cursor.description doesn't set type_code
Gerhard Häring added the comment: There is no guarantee that all any column in a SQlite resultset always has the same type. That's why I decided to err on the side of setting the type code to undefined. Closing as wontfix. -- resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11691 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24887] Sqlite3 has no option to provide open flags
Gerhard Häring added the comment: It requires switch to the v2 open function of the SQLite C API. While we're at it, we can also enable URI filenames. -- assignee: - ghaering nosy: +ghaering versions: +Python 3.6 -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24887 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19065] sqlite3 timestamp adapter chokes on timezones
Gerhard Häring added the comment: I'm -1 on adding timezone to the adapters. -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19065 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16379] SQLite error code not exposed to python
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16379 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21250] sqlite3 doesn't have unit tests for 'insert or [algorithm]' functionality.
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21250 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16864] sqlite3.Cursor.lastrowid isn't populated when executing a SQL REPLACE statement
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16864 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9303] Migrate sqlite3 module to _v2 API to enhance performance
Gerhard Häring added the comment: The externally maintained version of the sqlite3 module has now been switched to the v2 statement API. pysqlite is for Python 2.7 only. I'd suggest to revisit this for Python 3.6 and then try to port most fixes from pysqlite to the sqlite3 module. -- resolution: - postponed versions: +Python 3.6 -Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9303 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13299] namedtuple row factory for sqlite3
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13299 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20587] sqlite3 converter not being called
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering nosy: +ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20587 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10740] sqlite3 module breaks transactions and potentially corrupts data
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10740 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20463] sqlite dumpiter dumps invalid script when virtual tables are used
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20463 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11691] sqlite3 Cursor.description doesn't set type_code
Changes by Gerhard Häring g...@ghaering.de: -- assignee: docs@python - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11691 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9924] sqlite3 SELECT does not BEGIN a transaction, but should according to spec
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9924 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20274] sqlite module has bad argument parsing code, including undefined behavior in C
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering nosy: +ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20274 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20562] sqlite3 returns result set with doubled first entry
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering nosy: +ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20562 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16958] The sqlite3 context manager does not work with isolation_level=None
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16958 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21465] sqlite3 Row can return duplicate keys when using adapters
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21465 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13583] sqlite3.Row doesn't support slice indexes
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13583 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21836] Fix sqlite3 in unicodeless build
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21836 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9303] Migrate sqlite3 module to _v2 API to enhance performance
Gerhard Häring added the comment: ok, i will have to look into this -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9303 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22956] Improved support for prepared SQL statements
Gerhard Häring added the comment: The low-hanging fruit of executemany() reusing the prepared statement is of course taken. Also, there is a statement cache that is being used transparently. I am against exposing the statement directly via the API. -- assignee: - ghaering nosy: +ghaering priority: normal - low resolution: - rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22956 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21718] sqlite3 cursor.description seems to rely on incomplete statement parsing for detection
Gerhard Häring added the comment: I have now committed a fix in the pysqlite project at github. https://github.com/ghaering/pysqlite/commit/f67fa9c898a4713850e16934046f0fe2cba8c44c I'll eventually merge it into the Python tree. -- assignee: - ghaering nosy: +ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21718 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22382] sqlite3 connection built from apsw connection should raise IntegrityError, not DatabaseError
Gerhard Häring added the comment: Reusing the apsw connection in the sqlite3 module was deprecated a long time ago. It is simply not supported, even if there is still code left in the module that supports this somewhat. This code should then be removed. This closing as wontfix. -- assignee: - ghaering resolution: third party - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22382 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14076] sqlite3 module ignores placeholders in CREATE TRIGGER code
Gerhard Häring added the comment: The sqlite3 module is not at fault here. If it does not work, then is is a restriction of SQLite3 - at which places it accepts bind parameters. This closing as not a bug. -- assignee: - ghaering resolution: - not a bug status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14076 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15460] SQLite cursor.description is not DB-API compatible
Gerhard Häring g...@ghaering.de added the comment: SQLite's columns aren't typed, only SQLite values are. So it's entirely possible for the same column to have different types, like the NULL type, the INTEGER type and the TEXT type. It's thus impossible to give meaningful type information in a SQLite3 DB-API module. That's why it's set to None instead. -- resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10020] docs for sqlite3 describe functions not available without recompiling
Gerhard Häring g...@ghaering.de added the comment: Without SQLITE_OMIT_LOAD_EXTENSION, builds will break on Mac OS X 10.5 and 10.6 and maybe other platforms. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10020 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10020] docs for sqlite3 describe functions not available without recompiling
Gerhard Häring g...@ghaering.de added the comment: Fixed in r85208 by adding a note to the docs. -- resolution: - fixed status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10020 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9924] sqlite3 SELECT does not BEGIN a transaction, but should according to spec
Gerhard Häring g...@ghaering.de added the comment: Yes Mike. Avoiding unnecessary locks was exactly the reason for this behaviour. I agree that for serializable transactions I'd need to make some changes. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9924 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: are there pros or contras, keeping a connection to a (sqlite) database ?
On Thu, Sep 9, 2010 at 12:29 AM, CM cmpyt...@gmail.com wrote: [...] I'm not even sure what a connection really is; I assumed it was nothing more than a rule that says to write to the database with the file named in the parentheses. [...] The following list is not exclusive, but these are the first things that I can think of. - SQLite connections have state like uncommitted transactions - SQLite connections have page caches and metadata caches (tables, structures and indices) Opening and closing SQLite connections is very cheap, but keeping connections open is usually a better approach. You have to have a global setting like the path to the database file anyway; so you can wrap a global connection object in a factory function just as well. In database applications that use the raw DB-APi i usually start with something like: def get_con(): # return database connection ... HTH -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
[issue9750] sqlite3 iterdump fails on column with reserved name
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9750 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6683] smtplib authentication - try all mechanisms
Gerhard Häring g...@ghaering.de added the comment: Wow! That's great! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6683 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3854] Document sqlite3 vs. threads
Gerhard Häring g...@ghaering.de added the comment: Fixed in r83747. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3854 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9510] sqlite3.Warning isnt a subclass of exceptions.Warning
Gerhard Häring g...@ghaering.de added the comment: PEP 0249 says that the module's Warning class must be a subclass of StandardError. So I reject your proposed change. There are only two cases where pysqlite raises Warning, and these could be changed to ProgrammerError anyway. -- assignee: - ghaering resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9510 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6683] smtplib authentication - try all mechanisms
Gerhard Häring g...@ghaering.de added the comment: Fixed in r83742. I implemented this without a test case, because if we wait for a test case for this, we can wait forever (would need a SMTP server implementation in Python for the various auth methods). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6683 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8196] sqlit3.paramstyle reported as 'qmark'
Gerhard Häring g...@ghaering.de added the comment: There is too little value changing the paramstyle attribute. I think the documentation clearly states that both parameter binding methods are supported. -- resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8196 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4032] distutils cannot recognize .dll.a as library on cygwin
Changes by Gerhard Häring g...@ghaering.de: -- nosy: -ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4032 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue588756] python should obey the FHS
Changes by Gerhard Häring g...@ghaering.de: -- nosy: -ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue588756 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9303] Migrate sqlite3 module to _v2 API to enhance performance
Gerhard Häring g...@ghaering.de added the comment: Yes, the sqlite module uses the old API, and is written to work with older SQLite releases and their respective bugs as well. Using the new API will mean requiring newer SQLite releases. If we do this, then this is the chance to remove all the obscure backwards compatibility code with older SQLite releases. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9303 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
rich comparison fscks up reference count?
Maybe somebody can enlighten me here. I can't figure out why doing a rich comparison on my object decreases the total reference count by 1. Linked is the minimal test case with a C exension that compiles under both Python 2.6 and 3.1. No external dependencies, except a DEBUG build of Python to see the effect (Py_REF_DEBUG defined). http://cdn.ghaering.de/foo.c http://cdn.ghaering.de/setup.py Builtin types like list, dict, etc. don't seem to have the same effect. I've also run the test a few thousand times; then the total refcount is like -5, but Python does not crash. Also if I print all objects and their respective refcounts using the gc module, none of them seems to have a negative refcount, but the total refcount is still way negative. How could that be? -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: rich comparison fscks up reference count?
Can be run like this: ghaer...@ws124~/src/gh/test$ python3 setup.py build_ext --inplace running build_ext building 'foo' extension gcc -fno-strict-aliasing -g -fwrapv -O0 -Wall -Wstrict-prototypes - arch i386 -m32 -I/opt/jetstream/include/python3.1 -c foo.c -o build/ temp.macosx-10.4-i386-3.1-pydebug/foo.o foo.c: In function ‘PyInit_foo’: foo.c:109: warning: return makes pointer from integer without a cast gcc -bundle -undefined dynamic_lookup -arch i386 -m32 build/ temp.macosx-10.4-i386-3.1-pydebug/foo.o -o /Users/ghaering/src/gh/test/ foo.so [50367 refs] ghaer...@ws124~/src/gh/test$ python3 setup.py test running test total refcount 65304 total refcount 65305 total refcount 65304 total refcount 65303 total refcount 65302 total refcount 65301 total refcount 65300 total refcount 65299 total refcount 65298 total refcount 65297 [45322 refs] ghaer...@ws124~/src/gh/test$ -- http://mail.python.org/mailman/listinfo/python-list
Re: rich comparison fscks up reference count?
On Apr 12, 4:27 pm, Gerhard Häring gerhardhaer...@googlemail.com wrote: Maybe somebody can enlighten me here. I can't figure out why doing a rich comparison on my object decreases the total reference count by 1. [...] Doh! It turned out the strange effect was due to my particular build process. My Python 2.6/3.1 are built using our own SCons-based build and the corresponding Makefile that distutils then uses didn't have the same DEFINEs. So, the Python was built with Py_REF_DEBUG, but Py_REF_DEBUG was not defined when I built my extension module. Which fscked up the *total* reference counting (sys.gettotalrefcount()). -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
[issue7723] sqlite only accept buffer() for BLOB objects (input/output)
Gerhard Häring g...@ghaering.de added the comment: I see that the status of this issue keeps changing. Now does anything in the sqlite3 module or the docs need to be changed? Or what's left to close this? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7723 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5872] New C API for declaring Python types
Changes by Gerhard Häring g...@ghaering.de: -- nosy: +ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5872 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8196] sqlit3.paramstyle reported as 'qmark'
Gerhard Häring g...@ghaering.de added the comment: I said qmark vs numeric. I. e. vs: execute(UPDATE authors set name = :1, email = :2, comment = :3 WHERE id = :4, (form.name, form.email, form.text, form.id)) The sqlite3 module will always support both paramstyles qmark and named, simply because that is what the underlying SQLite engine supports. What paramstyle says is mostly important for third-party software that works across multiple DB-API compliant database modules. paramstyle enables them to use database supported parameter binding. In reality, though, there will hardly be a wrapper for DB-API modules that does *not* need to special-case anything depending on the underlying database. So they will hardly ever rely only on the paramstyle and threadsafety parameters. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8196 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8196] sqlit3.paramstyle reported as 'qmark'
Gerhard Häring g...@ghaering.de added the comment: Thanks for bringing this up. By changing this we would maybe be a little bit closer to PEP 0249. I don't get why the PEP author thinks that 'qmark' is less clear than 'numeric', though. I think they're equally clear. The real reason why I object changing anything here, however, is that by changing the paramstyle we would break backwards compatibility. Third-party software like ORMs might depend on sqlite3 having paramstyle 'qmark'. So now someone might suggest to make paramstyle an instance of a subclass of string that will successfully compare against both 'qmark' and 'named'. To which possible suggestion I say forget it. You cannot anticipate how people will really access the paramstyle. And if it would make a difference in real-world scenarios. -- priority: - low ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8196 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8145] Documentation about sqlite3 isolation_level
Changes by Gerhard Häring g...@ghaering.de: -- nosy: +ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8145 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ANN] pysqlite 2.6.0 released
pysqlite 2.6.0 released === Release focus: Synchronize with sqlite3 module in Python trunk. pysqlite is a DB-API 2.0-compliant database interface for SQLite. SQLite is a in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. Go to http://pysqlite.googlecode.com/ for downloads, online documentation and for reporting bugs. Changes === - pysqlite can now be built against Python versions without thread support - PyDict_SetItem is now checked so you cannot shoot yourself in the foot, even if you try to - More checks for closed connections were added to avoid possible segfaults Compatibility = Warning: pysqlite is not supported for Python 2.5 any longer. This release still builds against Python 2.3 and 2.4, but I won't bother with these in the future. -- http://mail.python.org/mailman/listinfo/python-list
[issue7670] _sqlite3: Block *all* operations on a closed Connection object
Gerhard Häring g...@ghaering.de added the comment: Applied in trunk. Thanks! -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7670 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7478] _sqlite3 doesn't catch PyDict_SetItem error
Gerhard Häring g...@ghaering.de added the comment: Fixed in trunk now. Thanks! -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7478 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7670] _sqlite3: Block *all* operations on a closed Connection object
Gerhard Häring g...@ghaering.de added the comment: Now also fixed in 2.6 and 3.1 maintenance branches. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7670 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7670] _sqlite3: Block *all* operations on a closed Connection object
Gerhard Häring g...@ghaering.de added the comment: As requested per Barry, marking this as release blocker for 2.6. -- keywords: +26backport priority: - release blocker stage: patch review - commit review status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7670 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Building Python with Scons
I'm setting up a third-party library project (similar to the one in Google Chromium) where I use SCons as build tool. Now I need to integrate Python, too. Has anybody written a Scons script for Python 2.x or 3.x, yet? -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
[issue7572] Strange issue : cursor.commit() with sqlite
Changes by Gerhard Häring g...@ghaering.de: -- title: Strabge issue : cursor.commit() with sqlite - Strange issue : cursor.commit() with sqlite ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7572] Strange issue : cursor.commit() with sqlite
Gerhard Häring g...@ghaering.de added the comment: You confuse two things here: cursors and connections. Indeed closing a connection without calling commit() on it will do an implicit rollback, i. e. any changes on the database will not be persisted. Closing cursors, however does nothing except invalidating the cursor object for further usage. Cursors are basically only used for executing SQL and looping over resultsets. You can reuse them or you can close them and open new ones. But they have no relationship whatsoever with transactions. I hope this clears things up. I'm closing the issue now. -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7572] Strabge issue : cursor.commit() with sqlite
Gerhard Häring g...@ghaering.de added the comment: Please change your test case so that it works with an in-memory database :memory:. Then you'll also need to include a schema creation command create table, which is missing here. Please also state which behaviour you see and which one you expect. Best is to provide a test case that asserts the expected behaviour in code. For example if you expect a certain SELECT statement to return more than one value, you can use code like this: {{{ cur.execute(select ...) rows = cur.fetchall() assert len(rows) 1 }}} -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7394] sqlite3: some OperationalError exceptions should be ProgrammingError (PEP 249)
Gerhard Häring g...@ghaering.de added the comment: The error code SQLITE_ERROR from SQLite is used for runtime errors. These can either be caused by the programmer (table does not exist, SQL contains errors) or they can be other problems like constraint violations etc. To differentiate these we would need to parse the error message returned by sqlite3_errmsg(). This is a path I don't want to go: it's hard to get this right across current and future SQLite versions. So I'm closing this issue as wontfix. -- assignee: - ghaering resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7478] _sqlite3 doesn't catch PyDict_SetItem error
Gerhard Häring g...@ghaering.de added the comment: Thanks! I've integrated this into pysqlite (http://code.google.com/p/pysqlite/source/detail?r=6455981b3283b26c147d949a9031a0d74ea7ffe8) and will soon push updates to the version in Python core. In my opinion this changes is not critical enough to warrant pushing it into Python 2.6. Do you agree? -- assignee: - ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7478 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Why Doesn't XP Pro Show Size, Time and Date Mod of a Created File?
W. eWatson wrote: I created a folder, and wrote a file to it. When I look at what files are in it, they are correct. However, The Size, Type, and Date Mod are not shown. Why am I missing those columns? I'm writing files with a suffix of dat, which seem only to match up with video CD movie. That's probably a Windows Explorer thing. The column may be hidden or moved away to the far right. As far as Python is concerned, you can fetch this kind of information with the stat() function of the os module. import os, time stat_info = os.stat(x) print size:, stat_info.st_size print modification time:, time.strftime(%Y-%m-%d %H:%M, time.localtime(stat_info.st_mtime)) -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: editor with autocompletion
Siva B wrote: Hi friends, I am writing a new language. So I want an editor with auto complete. I there any such tool in Python ?(not only in python any other) I want it for my new lang IDLE, the Integrated Development Environment included with your Python installation nowadays has autocompletion (I just check with the one included in Python 2.6). -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
[issue2441] Mac build_install.py script fetches unavailable SQLite version
Gerhard Häring g...@ghaering.de added the comment: This has long been fixed. Even for 2.6maint the SQLite version currently being fetched is 3.6.11. -- resolution: - out of date status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2441 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: dbapi2 select where IN (...)
yota.n...@gmail.com wrote: hello, I couldn't find how the dbapi2 planned to handle the sql IN statement. ex : SELECT * FROM table WHERE num IN (2,3,8,9); I'd be glad to take advantage of the ? mechanism, but what about tuples ! execute(SELECT * FROM table WHERE num IN ?; , ((2,3,8,9),))...fail... [...] You cannot use parameter binding when the number of parameters is unknown in advance. So you'll have to create this part of the SQL query differently. For example: ids = [2, 3, 8, 9] in_clause = ( + ,.join([str(id) for id in ids]) + ) query = select * from table where num in + in_clause -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: IDE+hg
Rhodri James wrote: On Mon, 23 Nov 2009 19:20:27 -, NiklasRTZ nikla...@gmail.com wrote: Dear experts, Since no py IDE I found has easy hg access. IDEs PIDA and Eric claim Mercurial support not found i.e. buttons to clone, commit and push to repositories to define dev env dvcs, editor and deployment all in 1. I don't really understand this urge to cram everything into a single program, since that inevitably leads to compromises that will compromise just how much of Mercurial's useful and interesting functionality you can get at. Still, if you really must, Emacs (and presumably vim) seems to be capable of working with most source control systems. I prefer the commandline tools, too. FWIW, Eclipse supports Mercurial through http://www.vectrace.com/mercurialeclipse/ -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Python OpenOffice Spreadsheets
Is there a *simple* way to read OpenOffice spreadsheets? Bonus: write them, too? I mean something like: doc.cells[0][0] = foo doc.save(xyz.ods) From a quick look, pyodf offers little more than just using a XML parser directly. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: python and web pages
Daniel Dalton wrote: Hi, Here is my situation: I'm using the command line, as in, I'm not starting gnome or kde (I'm on linux.) I have a string of text attached to a variable,. So I need to use one of the browsers on linux, that run under the command line, eg. lynx, elinks, links, links2 and do the following. No, you don't need any text mode browser. It's much easier to do with modules from the Python standard library. 1. Open a certain web page and find the first text box on the page, and put this text into the form. I assume you know HTML and HTTP. You can use urllib or urllib2 to submit the form. 2. Press the submit button, and wait for the result page to load. 3. Click on the 15th link down the page. You will then get the returned HTML from a function and you will have to parse it for the link you're interested in. There are many approaches to get there. Manual parsing, regular expressions or one of the XML parsers in the standard library (etree is the easiest). So, how do I do this, can anyone point me to some docs or modules that may help out here? While all of this may seem overwhelming at first, I guess the solution can be written in 20 - 30 lines of code. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Python: Text file insert to MySQL
On Wed, Oct 7, 2009 at 1:32 PM, Schedule ssched...@gmail.com wrote: That was great ! Now I am able to insert the values from the file. Somehow I am not able to update a specific field with all the vaues in the file. For eg: [...] c.execute(UPDATE a SET last = %s, row) The database does what you say, not what you mean ;-) SQL commands like SELECT, UPDATE, DELETE work on sets. If you don't qualify the set any further, you always operate on the whole set. To restrict the set, apply a WHERE clause. I. e. Perhaps you should try a SQL tutorial before jumping into SQL + Python. Here's one: http://sqlzoo.net/ -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Python: Text file insert to MySQL
Schedule wrote: Hello, I am currenty using MySQL 5.1 community server and trying to import the data of the comma delimited text file into the table using python 2.6 scripts. I have installed Mysqldb 1.2.2. follwoing is my script: [...] 7. c.execute(INSERT INTO a (first, last) VALUES (%s, %s), row) [...] When I execute the statement I get the following error: [...] _mysql_exceptions.ProgrammingError: (1064, You have an error in your SQL syntax; check the manual tha t corresponds to your MySQL server version for the right syntax to use near '%s, %s), row' at line 1) You misplaced the closing quote. wrong: c.execute(INSERT INTO a (first, last) VALUES (%s, %s), row) correct: c.execute(INSERT INTO a (first, last) VALUES (%s, %s), row) -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Compile kinterbasdb with mingw32 and python 2.6 - DLL load failed
Laszlo Nagy wrote: The building and installation went find. But I cannot import kinterbasdb because I get a DLL load failed error. I figured out that has something to do with msvcr90 and _ftime. Can you please give me some advice how to solve this problem? Download Microsoft Visual C++.2008 Express Edition Its license does not allow us to create services for internet if we charge fees. At least this is what I was told. Does this mean that using kinterbasdb (compiled with MSVC express) I'm forbidden to write commercial internet services? :-s I see three options: 1) Ask a laywer. 2) Download the MSVC express compiled version from somewhere else. ; adhere to the kinterbasdb license; let MS license issues not be your problem - or at least now having plausible deniability. 3) F*ck license issues. You're not redistributing anything, who will know what software compiled with which compilers you're using? Well, or just use mingw. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
[issue6683] smtplib authentication - try all mechanisms
Changes by Gerhard Häring g...@ghaering.de: -- assignee: - ghaering nosy: +ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6683 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: file comparison
learner learner wrote: Hi all, I want to compare two text files line by line and eliminate the matching/repeated line and store the unmatched/leftout lines into a third file or overwrite into one of them. gl hf! -- http://mail.python.org/mailman/listinfo/python-list
Re: non-owning references?
Utpal Sarkar wrote: Hi, [...] You're looking for the weakref module. What you're describing there sounds like a nice exercise, but I cannot imagine why you'd really need to clean it up, if it really is a singleton. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Creating xml
Greg Lindstrom wrote: It's been a while since I've played with XML using Python but I've been asked to create XML using data from our postgres database. Currently we are generating XML directly from the database using a set of stored procedures but it is too slow (yes, I have numbers). I have been asked to create a routine to generate the XML to see if it will be faster that the sprocs (which I think it will be, based on other routines we have running). But I digress... I write to a cStringIO.StringIO instance to create XML. Like this (pseudo-code): class Foo: def toxml(self, stream): print stream, foo ... / If you're concerned about producing valid XML, you can write tests ;-) Using my favorite search engine I see that there is a lot of material on Python and XML. At the risk of starting something (which is not my intention), what are my options if I want to create xml? Ceratinly writing my own routine is an option, but I bet there are better ones :-) How about if I need/want to parse or process an XML file? Use lxml. It's blazingly fast and its XPath support makes parsing XML a snap. If you don't want to depend on anything not in the standard library, use the etree module. Code will be slightly longer because you don't have XPath support and performance will be only ok. Not super-fast, like with lxml. HTH -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Column types with DB API
Thomas Robitaille wrote: Hi, I'm trying to use DB API compliant database modules (psycopg2,MySQLdb,SQLite) to access SQL databases, and I am trying to determine the type of each column in a table. The DB API defines cursor.description which contains information about the column names and types (once .execute() has been used to select part or all of the table), but the types are expressed as integers. I realize that these numbers can be checked against the type objects such as MySQLdb.NUMBER to determine whether a given column is a number, a date, text, etc. However, is there any way to determine what the sub-type of a column is, for example if a column is a NUMBER, is there a way to determine if it is a 2, 4, or 8-byte integer or real number? Not with the DB-API. You'll have to implement all this for each database separately. For some databases (like SQLite) it's even impossible. I suggest you don't bother with cursor.description at all. Depending on it doesn't harmonize with the way Python is typically used: duck typing. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: [RELEASED] Python 3.1 final
Scott David Daniels wrote: Nobody wrote: On Sat, 27 Jun 2009 16:12:10 -0500, Benjamin Peterson wrote: announcement of 3.1 That's a significant improvement All in all, Python 3.x still has a long way to go before it will be suitable for real-world use. Fortunately, I have assiduously avoided the real word, and am happy to embrace the world from our 'bot overlords. Congratulations on another release from the hydra-like world of multi-head development. +1 QOTW -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: sqlite3, OperationalError: no such column, shouldn't that ne a ProgrammingError?
Gabriel Rossetti wrote: Hello everyone, I get an OperationalError with sqlite3 if I put the wrong column name, but shouldn't that be a ProgrammingError instead? I read PEP 249 and it says : OperationalError Exception raised for errors that are related to the database's operation and not necessarily under the control of the programmer, e.g. an unexpected disconnect occurs, the data source name is not found, a transaction could not be processed, a memory allocation error occurred during processing, etc. It must be a subclass of DatabaseError. ProgrammingError Exception raised for programming errors, e.g. table not found or already exists, syntax error in the SQL statement, wrong number of parameters specified, etc. It must be a subclass of DatabaseError. and to me it sounds more like a programming error than an operational error. I agree. But I can't help you there. See _pysqlite_seterror() at http://oss.itsystementwicklung.de/trac/pysqlite/browser/src/util.c What I do is map SQLite error codes to DB-API exceptions. And SQLite reports your error as generic SQLITE_ERROR, which is mapped to OperationalError. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: sqlite3, OperationalError: no such column, shouldn't that ne a ProgrammingError?
John Machin wrote: Hi Gerhard, [...] In http://www.sqlite.org/c3ref/prepare.html it says When an error occurs, sqlite3_step() will return one of the detailed error codes or extended error codes. The legacy behavior was that sqlite3_step() would only return a generic SQLITE_ERROR result code and you would have to make a second call to sqlite3_reset() in order to find the underlying cause of the problem. With the v2 prepare interfaces, the underlying reason for the error is returned immediately. Are you using sqlite3_prepare() or sqlite3_prepare_v2()? sqlite3_errcode() or sqlite3_extended_errcode()? Because of compatibility with older SQLite versions, I'm using the old API only. I'll change this one day and then I'll be able to throw a lot of compatibility code out of the window, too. But I certainly won't go #ifdef hell and implement both. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Observer implementations
Tobias Weber wrote: Hi, how to use the Observer pattern in Python? Implement it in your classes? I found PubSub and PyDispatcher, both of which are abandoned. [...] I haven't searched for these, but googling for python observer pattern yields http://code.activestate.com/recipes/131499/ and this seems like a good inspiritation for owns own implementation. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
[issue6057] sqlite3 error classes should be documented
Gerhard Häring g...@ghaering.de added the comment: At the very start of the module's documentation it reads: pysqlite was written by Gerhard Häring and provides a SQL interface compliant with the DB-API 2.0 specification described by PEP 249. Where PEP 249 is a link to the Database API 2.0 specification, which does document the xception classes and their hierarchy. -- priority: - low ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6057 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: command prompt: the ntvdm cpu has encountered an illegal instruction
Daniel wrote: If I try to invoke python via the command prompt I get an error command prompt: the ntvdm cpu has encountered an illegal instruction... I don't get this problem if I first cd to the python directory. I am running python 3.0 on windows. Running Python from the Cygwin shell? Try from outside Cygwin, then. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Learning C++ for Python Development
joshua.pea...@gmail.com wrote: I am a recovering C# web developer who has recently picked up Django and I'm loving it. I would eventually like to get a job as a Django/Python developer. It seems that many Python jobs require that you also be a C++ developer. I've seen the C++/Python combination in job descriptions, too. ISTM that these are about systems that are written in C++ and then scripted in Python. For speeding up Python applications. While I want to remain primarily a web developer, I don't want be stuck doing CRUD applications, so I would like to learn C++ for Python development. In the web development field, the probability for doing custom C/C++ development is very low in my experience. I have taken two basic programming courses in straight up C++, no STL, Boost or anything like that, but I do have a very basic knowledge of the language. Learning progamming languages never hurts, but I'd recommend you learn C instead, perhaps by using the Python C API (writing small extension modules). There are not so many Python extensions written in C++, most are written in C. C++ usually doesn't buy you enough to warrant using it instead of C here. So my advice: go with C. Or learn something more relevant to web programming. Like improve your JavaScript skills ;-) [...] -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: configuring python with disable-thread in Ubuntu
Deepak Chandran wrote: Hello, I am embedding python inside a C++ program. For some reason (I think libxml2), I am getting Segmentation fault at PyThread_release_lock. The solution I found online was to configure python with --disable-thread. That doesn't sound like a solution, but like a kludge. I used apt-get install python-dev to install python. How do I re-configure it using the --disable-thread option? You don't want your system Python to be built with --disable-thread. Other utilities might depend on threads being available in Python. If you really want to go this route, download Python from python.org and build it from source with the required options to ./configure. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: update python version
km wrote: Hi all, Is there a way to update python 2.6.1 to 2.6.2 using easy_install ? No, easy_install installs Python packages. It doesn't upgrade Python itself. If this is Windows, just install the newer Python version. No need to uninstall the 2.6.1 first. If this is some Unix variant, hopefully they will provide updated Python packages soon. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Web framework for embedded system
Thomas Heller wrote: I'm looking for a lightweight web-framework for an embedded system. The system is running a realtime linux-variant on a 200 MHz ARM processor, Python reports a performance of around 500 pystones. The web application will not be too fancy, no databases involved for example, but it will need to control some simple peripherals (some parallel in/out, some dacs) attached to the system. It should provide a user interface showing the current state and allowing to manipulate it via a browser, and I will probably need to support some rpc as well. Does this sound sensible at all? Any suggestions? I'd try first what I know best. In my case Django. Despite the restricted hardware, it might just work fine because you'll only use a tiny fraction of it. If this doesn't work because of CPU or memory requirements, I'd next try to build my own using components like - CherryPy for the web server, it should also be able to handle your (XML)RPC requirements - some templating language like Mako (my favourite) It doesn't sound like you need much more. You could even build upon wsgiref, string.Template and the XMLRPC stuff in the standard library, but that's for people who like tinkering ;-) -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Memory problems (garbage collection)
Carbon Man wrote: Very new to Python, running 2.5 on windows. I am processing an XML file (7.2MB). Using the standard library I am recursively processing each node and parsing it. The branches don't go particularly deep. What is happening is that the program is running really really slowly, so slow that even running it over night, it still doesn't finish. Stepping through it I have noticed that memory usage has shot up from 190MB to 624MB and continues to climb. That sounds indeed like a problem in the code. But even if the XML file is only 7.2 MB the XML structures and what you create out of them have some overhead. If I set a break point and then stop the program the memory is not released. It is not until I shutdown PythonWin that the memory gets released. Then you're apparently looking at VSIZE or whatever it's called on Windows. It's the maximum memory the process ever allocated. And this usually *never* decreases, no matter what the application (Python or otherwise). [GC experiments] Unless you have circular references, in my experience automatic garbage collection in Python works fine. I never had to mess with it myself in 10 years of Python usage. If I have the program at a break and do gc.collect() it doesn't fix it, so whatever referencing is causing problems is still active. My program is parsing the XML and generating a Python program for SQLalchemy, but the program never gets a chance to run the memory problem is prior to that. It probably has something to do with the way I am string building. Yes, you're apparently concatenating strings. A lot. Don't do that. At least not this way: s = s += something s += else instead do this: from cStringIO import StringIO s = StringIO() s.write(something) s.write(else) ... s.seek(0) print s.read() or lst = [] lst.append(something) lst.append(else) print .join(lst) My apologies for the long post but without being able to see the code I doubt anyone can give me a solid answer so here it goes (sorry for the lack of comments): [...] Code snipped. Two tips: Use one of the above methods for concatenating strings. This is a common problem in Python (and other languages, Java and C# also have StringBuilder classes because of this). If you want to speed up your XML processing, use the ElementTree module in the standard library. It's a lot easier to use and also faster than what you're using currently. A bonus is it can be swapped out for the even faster lxml module (externally available, not in the standard library) by changing a single import for another noticable performance improvement. HTH -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Memory problems (garbage collection)
Here's a link for you: http://wiki.python.org/moin/PythonSpeed/PerformanceTips which also talks about string concatenation and othere do's and don'ts. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: value error
Francesco Pietra wrote: hi: with script data = open('134-176_rectified_edited.pdb', 'r') outp = open('134-176_renumbered.pdb', 'w') for L in data: if L[3] == 'M': L = L[:24] + %4d % (int(L[24-28])+133) + L[28:] outp.write(L) i wanted to modify lines of the type: ATOM 1 HH31 ACE 1 1.573 1.961 0.769 1.00 0.00 H to add 133 to column 25, getting 134 there, and so on for next lines 2 - 135, 3 - 136, etc. i must have heavily messed things because the file was not even read: $ python renumber.py 134-176_rectified.pdb Traceback (most recent call last): File renumber.py, line 6, in module L = L[:24] + %4d % (int(L[24-28])+133) + L[28:] ValueError: invalid literal for int() with base 10: '' Instead of L[24-28] you want L[24:28]. Otherwise it's L[-4] ;-) -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: and [True,True] -- [True, True]?????
Peter Otten wrote: bdb112 wrote: Your explanation of Boolean ops on lists was clear. It leads to some intriguing results: bool([False]) -- True I wonder if python 3 changes any of this? No. Tests like if items: ... to verify that items is a non-empty list are a widespread idiom in Python. They rely on the behaviour you observe. Are they widespread? I haven't noticed, yet. I prefer to write it explicitly: if len(lst) 0: ... if item is None: ... etc. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: when can i expect libraries and third party tools to be updated for python 3 ?
Deep_Feelings wrote: every one is telling dont go with python 3 , 3rd party tools and libraries have no compitability with python 3 so from previous experience : when can i expect libraries and third party tools to be updated for python 3 ? (especially libraries ) The problem is: there is no previous experience. At least not in Python-land. Despite its major number, Python 2.0 was not disruptive. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: and [True,True] -- [True, True]?????
Martin v. Löwis wrote: Are they widespread? I haven't noticed, yet. I prefer to write it explicitly: if len(lst) 0: I prefer to test explicitly for the truth value of the list. I don't want to test whether the length of the list is greater than 0 (in fact, I don't care about the length property of the list at all) - I want to know whether the list is empty (or not empty). The Python syntax for this test is if lst: # not empty or if not list: #empty [...] You're right - as most of the time ;-) This makes a lot of sense to me. The reason I preferred len(), btw., was only that len() make it clear that the argument is a sequence. Maybe I was just too annoyed by lots of Python code I read that looked like this: def foo(x, y, z): if x: ... else: ... with poorly named variables where I didn't know what the heck the variables are (bool, list, instance, ...). I hate it when I have to look for the actual method calls to figure out what's going in. Better variable naming and small comments would often help. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
WHIFF - was: Re: Using Python after a few years of Ruby
Aaron Watters wrote: On Apr 15, 3:49 am, Tim Hoffman zutes...@gmail.com wrote: There are plenty of python web frameworks, some have quite different approaches, what suits you will depend very much on your own bias, interest. I've had a lot of luck with WHIFF ( http://whiff.sourceforge.net ) Of course I wrote it and just released it publicly recently. I'm a bit disappointed because I know a lot of people have looked at the docs and demos and there have been a number of downloads, but I haven't gotten one comment yet :( zilch nada. (There is one comment attached to one of the docs, but that was me testing the comments feature :) ). Back in the old days you could at least count on someone yelling at you about how your design was such a bad idea [Just read the docs for ca. 5 minutes.] That's perhaps because a lot of people had the same thought after short reading/trying out as me: WTF?! This is weird stuff! Why the hell would I use this instead of a Python web framework like Django/Pylons/etc. You should perhaps contrast WHIFF with the other offerings for creating web applications. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: [ANN] Falcon - powering innovation
Kless wrote: If anybody is interesed in new technologies, you'll love this new language called Falcon [1], which has been open sourced ago little time. Falcon is a scripting engine ready to empower mission-critical multithreaded applications. Mission-critical and empower sound like a good start for bullshit bingo :-P It provides six integrated programming paradigms: procedural, object oriented, prototype oriented, functional, tabular and message oriented. You use what you prefer. I've never heard of tabular programming before. To know more about its design, read the interview to the Falcon author that has published ComputerWorld Australia [2]. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list