-1

I use sqlite3 as database.

I'm trying to execute my SQL query :

sql = "INSERT INTO info_calc (application, version, path, os, user, ip) VALUES (?, ?, ?, ?, ?, ?)"
args = my_argv[2], my_argv[3], my_argv[4], sys.platform, getpass().getuser(), machine

c.execute(sql, args)

but I have this error :

args = my_argv[2], my_argv[3], my_argv[4], sys.platform, getpass().getuser(), machine
TypeError: 'module' object is not callable

I already saw this post : TypeError: 'module' object is not callable, but they spoke about socket.

Community
  • 1
  • 1
Glacius
  • 79
  • 7

1 Answers1

1

getpass is a module, and you are calling it:

getpass().getuser()

Remove the first ():

>>> import getpass
>>> getpass()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable
>>> getpass.getuser()
'mj'
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • honestly, you surprise me ... I have posted an another question few hours ago, and no one gave me a correct answer (I knew it was not a problem of SQL syntax). – Glacius Jul 15 '14 at 12:50
  • 1
    @Glacius: the previous question I can see was a Python string syntax error. I note that the answer there uses `getpass` correctly, btw. – Martijn Pieters Jul 15 '14 at 12:51