title: Cannot save path to database (Python/Windows)
body: <p>I'm making a program that is suppoused to move files and save their new paths in a database.
  I do, however, have great problems with putting together and executing the SQL-query that inserts them into the database.</p>
  
  <p>This is the program:</p>
  
  <pre><code>#logspc.py
  import os
  import sqlite3 as lite
  import sys
  import time
  
  def getspc(path):
      dirs = os.listdir(path)
      spcfiles = []
      for filename in dirs:
          (shortname, extension) = os.path.splitext(filename)
          if extension == '.spc':
              spcfiles.append(filename)
      return spcfiles
  
  src=os.path.normpath(r'C:\users\python\nonpython')
  dest=os.path.normpath(r'C:\users\python\target')
  files=getspc(src)
  con = lite.connect('spcbase.db')
  cur=con.cursor()
  for mfile in files:
      oldpath=os.path.normpath(os.path.join(src,mfile))
      newpath=os.path.normpath(os.path.join(dest,mfile))
      os.rename(oldpath,newpath)
      query="INSERT INTO spectra VALUES ('" + newpath + "',SELECT date('now'))"
      print query
      cur.execute(query)
  con.close()    
  </code></pre>
  
  <p>It crashes on the line "cur.execute(query)", rendering this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Users/Python/logspc2.py", line 27, in &lt;module&gt;
      cur.execute(query)
  OperationalError: near "SELECT": syntax error
  </code></pre>
  
  <p>The value of the query-variable as printed is</p>
  
  <pre><code>INSERT INTO spectra VALUES ('C:\users\python\target\Bertil.spc',SELECT date('now'))
  </code></pre>
  
  <p>Where do I go from here?</p>