[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Attached patch consists of two commits: one to rename "conn" to "con", and one to rename "c" to "cur". Are you ok with that, Berker? -- Added file: https://bugs.python.org/file49851/patch.diff ___ Python

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: 'con' and 'cur' seems to be used in a majority of the examples. I suggest normalising to always using these two in code examples. -- ___ Python tracker

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Berker Peksag
Berker Peksag added the comment: No problem and thank you for taking time to report! I'd be happy to merge a PR that renames c to cur in the documentation (I counted four instances.) We can then reopen and retarget this isssue. -- resolution: -> not a bug

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Right, got me confused as well! I guess a clarification would be an improvement :) -- ___ Python tracker ___

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Tore Anderson
Tore Anderson added the comment: You're right. I got it confused with the conn object in the code I was working on, because it turns out that it has an execute() method: >>> import sqlite3 >>> c = sqlite3.connect('test.db') >>> c.execute('SELECT * FROM tbl') Closing, apologies for the

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Berker Peksag
Berker Peksag added the comment: https://github.com/python/cpython/blame/e161ec5dd7ba9355eb06757b9304019ac53cdf69/Doc/library/sqlite3.rst#L74-L76 is not a standalone snippet. It uses the cursor object created at

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Tore Anderson
Tore Anderson added the comment: You're looking in the wrong place, the buggy ones are at https://github.com/python/cpython/blame/e161ec5dd7ba9355eb06757b9304019ac53cdf69/Doc/library/sqlite3.rst#L74-L76 Tore -- ___ Python tracker

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Berker Peksag
Berker Peksag added the comment: Could you please post the full snippet? c is already set to a cursor at https://github.com/python/cpython/blame/e161ec5dd7ba9355eb06757b9304019ac53cdf69/Doc/library/sqlite3.rst#L56: c = conn.cursor() And the following example works fine: >>> import

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23515 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24745 ___ Python tracker

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Correct, fetchone() is a cursor method. Thanks for the report! -- nosy: +berker.peksag, erlendaasland ___ Python tracker ___

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-03 Thread Tore Anderson
New submission from Tore Anderson : In https://docs.python.org/3/library/sqlite3.html, the following example code is found: > # Do this instead > t = ('RHAT',) > c.execute('SELECT * FROM stocks WHERE symbol=?', t) > print(c.fetchone()) However this fails as follows: > Traceback (most recent