Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The problem is almost certainly that you're trying to create or open a database named <code>database.db</code> in whatever happens to be the current working directory, and one of the following is true:</p> <ul> <li>The database exists and you don't have permission to write to it. So, everything works until you try to do something that requires write access (like <code>commit</code>ing an <code>INSERT</code>).</li> <li>The database exists, and you have permission to write to it, but you don't have permission to create new files in the directory. So, everything works until sqlite needs to create a temporary file (which it almost always will for <code>execute</code>-ing an <code>INSERT</code>).</li> </ul> <p>Meanwhile, you don't mention what web server/container/etc. you're using, but apparently you have it configured to just swallow all errors silently, which is a really, really bad idea for any debugging. Configure it to report the errors in some way. Otherwise, you will <em>never</em> figure out what's going on with anything that goes wrong. </p> <p>If you don't have control over the server configuration, you can at least wrap all your code in a <code>try</code>/<code>except</code> and manually log exceptions to some file you have write access to (ideally via the <code>logging</code> module, or just <code>open</code> and <code>write</code> if worst comes to worst).</p> <p>Or, you can just do that with dumb <code>print</code> statements, as you're already doing:</p> <pre><code>def insertdb(unique_id,number_of_days): conn = sqlite3.connect('database.db') print "Opened database successfully"; try: conn.execute("INSERT INTO IDENT (ID_NUM,DAYS_LEFT) VALUES (?,?)",(unique_id,number_of_days)); conn.commit() print "Records created successfully"; except Exception as e: print e # or, better, traceback.print_exc() conn.close() </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload