Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7736119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:40:02+00:00 2026-06-01T07:40:02+00:00

I am a programming beginner, and would like to get a little help with

  • 0

I am a programming beginner, and would like to get a little help with learning SQLite and Python.

Currently, I have a database called “Status.db” which contains two columns. These columns are “stamp”, type INT, and “messages”, type TEXT, consecutively.

The code I am using to try to read one instance of messages, with a particular stamp, ID, into a variable “output” is as follows:

@cherrypy.expose
def comment(self, ID = None):
    con = lite.connect('static/database/Status.db')
    with con:    
        cur = con.cursor()    
        cur.execute("SELECT messages FROM Status WHERE stamp is ?", (ID,))
        temp = cur.fetchone()
        output = temp[0]

However, when i execute this code, I get an error message that reads:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/cherrypy/_cprequest.py", line 606, in respond
    cherrypy.response.body = self.handler()
  File "/usr/lib/pymodules/python2.7/cherrypy/_cpdispatch.py", line 25, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "proj1base.py", line 176, in comment
    output = temp[0]
TypeError: 'NoneType' object is not subscriptable

I am wondering if anyone could clarify to me what this error means, and what i could do to make it work.

Thanks in advance!

EDIT:
Here is the code that created and writes into the database

 @cherrypy.expose
    def writeStatus(self, newStatus=None, post=None):
        """Update the status file with the most recent status update
           by inserting a timestamp and new status into a database
        """

        con = lite.connect('static/database/Status.db')
        stamp = time()

        with con:

            cur = con.cursor() 
            cur.execute("CREATE TABLE IF NOT EXISTS Status(stamp INT, messages TEXT)")   
            cur.execute("INSERT INTO Status VALUES(?, ?)", (stamp, newStatus))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:40:03+00:00Added an answer on June 1, 2026 at 7:40 am

    That means that fetchone() is returning None, which means that your SQL query isn’t returning any result rows.

    This is probably because you should use = instead of is in your SQL:

    SELECT messages FROM Status WHERE stamp = ?
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a beginner in PHP programming and would like help with a little
I'm learning C# now and a beginner in the programming world. I have a
I'm a beginner in Java programming and would like to understand what is the
As I am a beginner in the PHP programming field, I would like to
I'm a beginner in programming. I've just made a program called Guessing Game. And
I'm a beginner to C programming. I'm trying to learning how to code a
I'm a beginner concerning socket programming and I have a problem when I send
I am a complete, total beginner in programming, although I do have knowledge of
I am a total Beginner in C++ and programming generaly. I have watched a
I consider myself a very beginner at python(and programming in general!), but I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.