LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-12-2018, 05:27 AM   #1
aihaike
Member
 
Registered: Feb 2006
Location: Paris, France
Distribution: Slackware, CentOS
Posts: 270

Rep: Reputation: 20
Question Issue with py-PostgreSQL [windows,python3]


Dear all,

I use Python package pyPostgreSQL to do some 'select' and 'set' on my DB. It's been working without any issue so far.
However, at one line in the code I get a weird error.

Here is the line:
Code:
dbh_query( "UPDATE public.\"tablename\" SET flag='2', first_data_name=\'%s\',dist=\'%s\' WHERE second_data_name=\'%s\'" % (l_1,l_index,l_0) )
And here the message:
Code:
TypeError: 'list' object is not callable
I replaced dbh_query by print to see what I was querying but the data looks correct.

I just can't figure what's wrong, why the previous similar queries works just fine but not that one especially.

I'm using Python 3.6.4 under Windows 12.

Any help would be appreciated.
Thank you.
 
Old 03-12-2018, 08:01 AM   #2
aihaike
Member
 
Registered: Feb 2006
Location: Paris, France
Distribution: Slackware, CentOS
Posts: 270

Original Poster
Rep: Reputation: 20
I just realized my mistake.

I import the module this way :
Code:
from pg import DB
Actually the line
Code:
dbh.query( "UPDATE public.\"tablename\" SET flag='2', first_data_name=\'%s\',dist=\'%s\' WHERE second_data_name=\'%s\'" % (l_1,l_index,l_0) )
For some reason became
Code:
dbh_query( "UPDATE public.\"tablename\" SET flag='2', first_data_name=\'%s\',dist=\'%s\' WHERE second_data_name=\'%s\'" % (l_1,l_index,l_0) )
So, the error message was making sense since this is a variable of type list in my code.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Issue trying to update a DB with db.py [windows,python3] aihaike Programming 4 02-17-2018 03:02 AM
[SOLVED] Python3 / GTK3 / AboutDialog Issue tonyfreeman Programming 3 11-19-2017 07:00 PM
[SOLVED] how to start python3.6 interpreter just by typing python in terminal not python3.6 bmohanraj91 Linux - Newbie 4 05-10-2017 07:51 AM
After upgrade python3.4 to python3.5.1 , not able to install packages "request" though pip3 YOGESHAS87 Linux - Software 1 08-03-2016 10:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration