def content_page(number_page): conn = sqlite3.connect('db.sqlite') c = conn.cursor() co = str(number_page) content = 'SELECT * FROM Сontent WHERE id = '+co+'' c.execute(content) rows = c.fetchone() # закрываем соединение с базой c.close() conn.close() content_data = [] content_data += rows return content_data number_page = 1 content_page(number_page) 

if so: content_data = content_page()

then get an error

 Traceback (most recent call last): ............... , line 30, in <module> content_data = content_page() TypeError: content_page() missing 1 required positional argument: 'number_page' 
  • 2
    Forgot to pass the argument - page number. This is how content_data = content_page(number_page) should be - qwerty123
  • yes, but then I need number_page = 1 content_page(number_page) be below ... and not before content_data = content_page(number_page) - Kill Noise
  • page number must be after, otherwise the content is NOT loaded - Kill Noise
  • And how are you going to call a function without an argument when it has a parameter (page number)?) - qwerty123
  • one
    aside: why do you manually collect sql queries, instead of using parameterized queries such as: c.execute('SELECT * FROM Сontent WHERE id = ?', (number_page,)) ? You have already asked a few questions about sql, I’m sure someone has already mentioned that you shouldn’t format the values ​​inside of sql with your hands — this is not safe, it may be less effective and more likely to make a mistake. - jfs

0